fleet/.github/workflows
2023-12-06 14:34:22 -05:00
..
config set default shell in workflows (#8108) 2022-10-07 09:43:56 -06:00
build-and-push-fleetctl-docker.yml Use go variable to set version in workflows (#14890) 2023-11-03 09:42:27 -05:00
build-binaries.yaml Use go variable to set version in workflows (#14890) 2023-11-03 09:42:27 -05:00
build-orbit.yaml Use go variable to set version in workflows (#14890) 2023-11-03 09:42:27 -05:00
codeql-analysis.yml Pin all workflow actions versions by commit (#13462) 2023-08-31 12:09:21 -05:00
deploy-fleet-website.yml Update the deploy-fleet-website workflow (#14756) 2023-10-26 17:24:56 -05:00
docs.yml Pin all workflow actions versions by commit (#13462) 2023-08-31 12:09:21 -05:00
dogfood-deploy.yml Dogfood github actions and monitoring module fixes (#14875) 2023-11-01 16:34:13 -05:00
example-workflow.yaml Bump fleetdm/fleet-mdm-gitops from 1.0.7 to 1.1.0 (#14453) 2023-10-11 13:52:31 -05:00
fleet-and-orbit.yml CI fix - Use bash in Start tunnel step (#14872) 2023-11-21 16:15:17 -07:00
fleetctl-preview-latest.yml Document milestone release ritual (#13932) 2023-09-25 14:35:36 -05:00
fleetctl-preview.yml Fix expected number of hosts for the Test fleetctl preview workflow (#13605) 2023-08-30 17:45:41 -03:00
fleetctl-workstations-canary.yml Update fleetctl-workstations-canary to macOS 14.1.1 (#15208) 2023-11-20 12:48:02 -05:00
fleetctl-workstations.yml Update fleetctl-workstations to min macOS 14.1.1 (#15209) 2023-11-20 12:50:52 -05:00
generate-desktop-targets.yml Bump Fleet Desktop version to v1.18.3 (#15123) 2023-11-14 07:07:55 -03:00
generate-nudge-targets.yml Pin all workflow actions versions by commit (#13462) 2023-08-31 12:09:21 -05:00
generate-osqueryd-targets.yml Generate targets for osquery 5.10.2 (#14828) 2023-11-07 14:32:41 -03:00
golangci-lint.yml Require a custom Clone for cacheable items, add tooling and CI check to help catch issues (#15458) 2023-12-06 14:34:22 -05:00
goreleaser-fleet.yaml Pin all workflow actions versions by commit (#13462) 2023-08-31 12:09:21 -05:00
goreleaser-orbit.yaml Pin all workflow actions versions by commit (#13462) 2023-08-31 12:09:21 -05:00
goreleaser-snapshot-fleet.yaml Use go variable to set version in workflows (#14890) 2023-11-03 09:42:27 -05:00
integration.yml Use go variable to set version in workflows (#14890) 2023-11-03 09:42:27 -05:00
pr-helm.yaml Pin all workflow actions versions by commit (#13462) 2023-08-31 12:09:21 -05:00
push-osquery-perf-to-ecr.yml Pin all workflow actions versions by commit (#13462) 2023-08-31 12:09:21 -05:00
README.md add concurrency to ci (#8271) 2022-10-24 14:01:00 -06:00
release-helm.yaml Pin all workflow actions versions by commit (#13462) 2023-08-31 12:09:21 -05:00
scorecards-analysis.yml Bump ossf/scorecard-action from 2.1.2 to 2.3.1 (#14723) 2023-10-24 14:25:02 -05:00
test-db-changes.yml Use go variable to set version in workflows (#14890) 2023-11-03 09:42:27 -05:00
test-go.yaml 14729 smtp settings validation for TLS (#15029) 2023-11-21 11:48:21 -07:00
test-native-tooling-packaging.yml Use go variable to set version in workflows (#14890) 2023-11-03 09:42:27 -05:00
test-packaging.yml Use go variable to set version in workflows (#14890) 2023-11-03 09:42:27 -05:00
test-website.yml Pin all workflow actions versions by commit (#13462) 2023-08-31 12:09:21 -05:00
test-yml-specs.yml Use go variable to set version in workflows (#14890) 2023-11-03 09:42:27 -05:00
test.yml Document milestone release ritual (#13932) 2023-09-25 14:35:36 -05:00
tfsec.yml Bump github/codeql-action from 2.2.4 to 2.20.1 (#12437) 2023-06-23 12:40:54 -07:00
tfvalidate.yml Pin all workflow actions versions by commit (#13462) 2023-08-31 12:09:21 -05:00
trivy_scan.yml Bump github/codeql-action from 2.2.4 to 2.20.1 (#12437) 2023-06-23 12:40:54 -07: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.