fleet/.github/workflows
KanchiMoe 9e9fd633c7
Update 'install go' Github Actions to use tag as it uses deprecated commands (#11408)
At the moment, in Github Actions, when a job has `uses:
actions/setup-go` it uses a specific commit from that repo.

In that commit, it used `set-output` somewhere, which is now deprecated
and will be disabled within the next month or so.

See here for more information:
https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/

This PR changes every instance where `actions/setup-go@...` was used and
replaces it with release `v2.1.3`. [From the release
notes](https://github.com/actions/setup-go/releases/tag/v2.1.3):

> Updated communication with runner to use environment files rather then
workflow commands

Which is what the above Github blog recommends doing.

---

Addationally, the latest version of this Github Action is
[`v4.0.0`](https://github.com/actions/setup-go/releases/tag/v4.0.0),
which you may want to update to in the future.
2023-05-17 15:56:16 -05:00
..
config set default shell in workflows (#8108) 2022-10-07 09:43:56 -06:00
build-and-push-fleetctl-docker.yml Update 'install go' Github Actions to use tag as it uses deprecated commands (#11408) 2023-05-17 15:56:16 -05:00
build-binaries.yaml Update 'install go' Github Actions to use tag as it uses deprecated commands (#11408) 2023-05-17 15:56:16 -05:00
build-orbit.yaml Update 'install go' Github Actions to use tag as it uses deprecated commands (#11408) 2023-05-17 15:56:16 -05:00
codeql-analysis.yml Bump github/codeql-action from 2.1.21 to 2.2.5 (#10220) 2023-03-01 11:39:55 -08:00
deploy-fleet-website.yml Update 'install go' Github Actions to use tag as it uses deprecated commands (#11408) 2023-05-17 15:56:16 -05:00
docs.yml add concurrency to ci (#8271) 2022-10-24 14:01:00 -06:00
dogfood-deploy.yml Warn against deploying fleetdm/fleet:main directly (#11316) 2023-04-25 13:22:59 -05:00
fleet-and-orbit.yml Update 'install go' Github Actions to use tag as it uses deprecated commands (#11408) 2023-05-17 15:56:16 -05:00
fleetctl-preview-latest.yml Update 'install go' Github Actions to use tag as it uses deprecated commands (#11408) 2023-05-17 15:56:16 -05:00
fleetctl-preview.yml Bump actions/upload-artifact from 3.1.0 to 3.1.2 (#10183) 2023-04-24 11:27:56 -07:00
fleetctl-workstations-canary.yml Use github action to apply profiles to workstations team (#11716) 2023-05-17 13:07:18 -05:00
fleetctl-workstations.yml Use github action to apply profiles to workstations team (#11716) 2023-05-17 13:07:18 -05:00
generate-desktop-targets.yml Update 'install go' Github Actions to use tag as it uses deprecated commands (#11408) 2023-05-17 15:56:16 -05:00
generate-nudge-targets.yml Bump actions/upload-artifact from 3.1.0 to 3.1.2 (#10183) 2023-04-24 11:27:56 -07:00
generate-osqueryd-targets.yml Bump actions/upload-artifact from 3.1.0 to 3.1.2 (#10183) 2023-04-24 11:27:56 -07:00
golangci-lint.yml Update 'install go' Github Actions to use tag as it uses deprecated commands (#11408) 2023-05-17 15:56:16 -05:00
goreleaser-fleet.yaml Update 'install go' Github Actions to use tag as it uses deprecated commands (#11408) 2023-05-17 15:56:16 -05:00
goreleaser-orbit.yaml Update 'install go' Github Actions to use tag as it uses deprecated commands (#11408) 2023-05-17 15:56:16 -05:00
goreleaser-snapshot-fleet.yaml Update 'install go' Github Actions to use tag as it uses deprecated commands (#11408) 2023-05-17 15:56:16 -05:00
integration.yml Update 'install go' Github Actions to use tag as it uses deprecated commands (#11408) 2023-05-17 15:56:16 -05:00
pr-helm.yaml add concurrency to ci (#8271) 2022-10-24 14:01:00 -06:00
push-osquery-perf-to-ecr.yml Bump aws-actions/amazon-ecr-login from 1.5.3 to 1.6.0 (#11514) 2023-05-03 12:06:24 -07:00
README.md add concurrency to ci (#8271) 2022-10-24 14:01:00 -06:00
release-helm.yaml Bump stefanprodan/helm-gh-pages from 1.5.0 to 1.7.0 (#8804) 2023-02-27 18:17:32 -08:00
scorecards-analysis.yml Bump actions/upload-artifact from 3.1.0 to 3.1.2 (#10183) 2023-04-24 11:27:56 -07:00
test-db-changes.yml Update 'install go' Github Actions to use tag as it uses deprecated commands (#11408) 2023-05-17 15:56:16 -05:00
test-go.yaml Update 'install go' Github Actions to use tag as it uses deprecated commands (#11408) 2023-05-17 15:56:16 -05:00
test-native-tooling-packaging.yml Update 'install go' Github Actions to use tag as it uses deprecated commands (#11408) 2023-05-17 15:56:16 -05:00
test-packaging.yml Update 'install go' Github Actions to use tag as it uses deprecated commands (#11408) 2023-05-17 15:56:16 -05:00
test-website.yml Website: fix failing GitHub workflows (#9285) 2023-01-11 13:31:20 -06:00
test-yml-specs.yml Update 'install go' Github Actions to use tag as it uses deprecated commands (#11408) 2023-05-17 15:56:16 -05:00
test.yml Bump actions/cache from 3.0.8 to 3.2.6 (#10268) 2023-03-02 13:51:13 -08:00
tfsec.yml Bump github/codeql-action from 2.1.21 to 2.2.5 (#10220) 2023-03-01 11:39:55 -08:00
tfvalidate.yml Pin actions to commit SHA (#10204) 2023-02-28 17:55:38 -08:00
trivy_scan.yml Pin actions to commit SHA (#10204) 2023-02-28 17:55:38 -08:00
update-certs.yml add concurrency to ci (#8271) 2022-10-24 14:01:00 -06:00

Github Actions

Fleet uses Github Actions for continuous integration (CI). This document describes best practices and at patterns for writing and maintaining Fleet's Github Actions workflows.

Bash

By default, Github Actions sets the shell to bash -e for linux and MacOS runners. To help write safer bash scripts in run jobs and avoid common issues, override the default by adding the following to the workflow file

defaults:
  run:
    # fail-fast using bash -eo pipefail. See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference
    shell: bash

By specifying the default shell to bash, some extra flags are set. The option pipefail changes the behaviour when using the pipe | operator such that if any command in a pipeline fails, that commands return code will be used a the return code for the whole pipeline. Consider the following example in test-go.yaml

    - name: Run Go Tests
      run: |
        # omitted ...
          make test-go 2>&1 | tee /tmp/gotest.log

If the pipefail option was not set, this job would always succeed because tee would always return success. This is not the intended behavior. Instead, we want the job to fail if make test-go fails.

Concurrency

Github Action runners are limited. If a lot of workflows are queued, they will wait in pending until a runner becomes available. This has caused issue in the past where workflows take an excessively long time to start. To help with this issue, use the following in workflows

# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
  group: ${{ github.workflow }}-${{ github.head_ref || github.run_id}}
  cancel-in-progress: true

When a workflow is triggered via a pull request, it will cancel previous running workflows for that pull request. This is especially useful when changes are pushed to a pull request frequently. Manually triggered workflows, workflows that run on a schedule, and workflows triggered by pushes to main are unaffected.