fleet/.github/workflows
2023-01-13 16:26:22 -08:00
..
config set default shell in workflows (#8108) 2022-10-07 09:43:56 -06:00
build-and-push-fleetctl-docker.yml Add quay push (#8967) 2022-12-12 14:15:06 -03:00
build-binaries.yaml Update go to 1.19.4 (#8945) 2022-12-09 11:47:17 -03:00
codeql-analysis.yml add concurrency to ci (#8271) 2022-10-24 14:01:00 -06:00
deploy-fleet-website.yml Website: fix failing GitHub workflows (#9285) 2023-01-11 13:31:20 -06:00
docs.yml add concurrency to ci (#8271) 2022-10-24 14:01:00 -06:00
dogfood-deploy.yml Prepare for 4.26.0 (#9326) 2023-01-13 16:26:22 -08:00
fleet-and-orbit.yml Windows installer now ensures that legacy osquery installations gets removed during clean install (#9048) 2022-12-19 16:06:44 -08:00
fleetctl-preview-latest.yml Update go to 1.19.4 (#8945) 2022-12-09 11:47:17 -03:00
fleetctl-preview.yml disable fleetctl preview tests on macos (#8911) 2022-12-02 11:29:38 -03:00
generate-desktop-targets.yml Update go to 1.19.4 (#8945) 2022-12-09 11:47:17 -03:00
generate-osqueryd-targets.yml Generate targets for osqueryd 5.6.0 (#8355) 2022-11-07 15:15:52 -08:00
golangci-lint.yml Update go to 1.19.4 (#8945) 2022-12-09 11:47:17 -03:00
goreleaser-fleet.yaml Use ubuntu-20.04 runner for Fleet build (#9114) 2022-12-22 14:48:41 -08:00
goreleaser-orbit.yaml Update go to 1.19.4 (#8945) 2022-12-09 11:47:17 -03:00
goreleaser-snapshot-fleet.yaml Add quay push (#8967) 2022-12-12 14:15:06 -03:00
integration.yml fix integration.yml CI workflow by setting a Go version (#8516) 2022-11-01 09:34:52 -03:00
pr-helm.yaml add concurrency to ci (#8271) 2022-10-24 14:01:00 -06:00
push-osquery-perf-to-ecr.yml add concurrency to ci (#8271) 2022-10-24 14:01:00 -06:00
README.md add concurrency to ci (#8271) 2022-10-24 14:01:00 -06:00
release-helm.yaml add concurrency to ci (#8271) 2022-10-24 14:01:00 -06:00
scorecards-analysis.yml add concurrency to ci (#8271) 2022-10-24 14:01:00 -06:00
test-db-changes.yml Update go to 1.19.4 (#8945) 2022-12-09 11:47:17 -03:00
test-go.yaml Fleet server and tooling to use NETWORK_TEST_GITHUB_TOKEN when environment variable is set. (#9143) 2023-01-03 14:56:11 -03:00
test-native-tooling-packaging.yml Update go to 1.19.4 (#8945) 2022-12-09 11:47:17 -03:00
test-packaging.yml Update go to 1.19.4 (#8945) 2022-12-09 11:47:17 -03:00
test-website.yml Website: fix failing GitHub workflows (#9285) 2023-01-11 13:31:20 -06:00
test.yml Test larger runner for E2E test action (#9066) 2022-12-23 09:37:03 -08:00
tfsec.yml add concurrency to ci (#8271) 2022-10-24 14:01:00 -06:00
tfvalidate.yml add concurrency to ci (#8271) 2022-10-24 14:01:00 -06:00
trivy_scan.yml 8241 trivy ignore file action (#8345) 2022-10-31 10:50:29 -04: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.