fleet/.github/workflows
Gabriel Hernandez 55c7f1e886
require a specific node and yarn version (#17205)
Adds a minimum supported node and yarn version to the project. 

Currently if you are on an unsupported version of node or yarn, there is
no messaging telling you that is the issue. The build just fails, and
you are left to figure out it's because of your node version. With this
change, it will be much clearer why any of the node required commands
(e.g. make deps, make generate-dev, make lint-js, make test-js) are not
working, and it will tell you exactly which minimum version of node or
yarn you need.

**After the console error is clear about using an unsupported node
version**


![image](https://github.com/fleetdm/fleet/assets/1153709/4f14bbf0-520e-45bc-911f-071554a996c4)


- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
- [x] Manual QA for all new/changed functionality
2024-03-13 12:45:28 +00: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 require a specific node and yarn version (#17205) 2024-03-13 12:45:28 +00:00
build-orbit.yaml Update fleetd CHANGELOG for the 1.20.0 release (#16000) 2024-01-10 13:55:19 -03:00
check-tuf-timestamps.yml add automation to check timestamp.json and send slack notification (#16012) 2024-01-10 17:06:52 -03:00
codeql-analysis.yml Update codeql workflow (#17067) 2024-02-22 12:27:52 -06:00
deploy-fleet-website.yml Website: Update script to create GH issues for rituals in YAML files. (#15752) 2024-01-15 12:53:53 -06:00
docs.yml Pin all workflow actions versions by commit (#13462) 2023-08-31 12:09:21 -05:00
dogfood-deploy.yml GeoLite2 addon for Dogfood and Cloud (#15643) 2023-12-14 13:22:11 -06:00
dogfood-gitops.yml Moving mdm_profiles to it-and-security/lib/mdm_profiles (#17268) 2024-03-01 15:18:54 -06:00
fleet-and-orbit.yml require a specific node and yarn version (#17205) 2024-03-13 12:45:28 +00:00
fleetctl-preview-latest.yml Move external dependency osquery-in-a-box to monorepo (#15871) 2024-01-10 11:45:52 -03:00
fleetctl-preview.yml Move external dependency osquery-in-a-box to monorepo (#15871) 2024-01-10 11:45:52 -03:00
fleetd-tuf.yml [On-call improve docs] Versions of currently released fleetd components on Fleet's TUF (#16698) 2024-02-15 15:30:29 -03:00
generate-desktop-targets.yml Start release of fleetd v1.22.0 (#17139) 2024-02-26 09:36:53 -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 osqueryd targets for 5.12.0 (#17403) 2024-03-06 10:46:27 -08: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 require a specific node and yarn version (#17205) 2024-03-13 12:45:28 +00:00
goreleaser-orbit.yaml Upload only orbit executable to ease future automation and reduce size of artifacts (#17024) 2024-02-21 20:12:18 -03:00
goreleaser-snapshot-fleet.yaml require a specific node and yarn version (#17205) 2024-03-13 12:45:28 +00: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-fleetd-chrome-beta.yml Re-enabling tests in fleetd release flow. (#16229) 2024-01-22 09:54:16 -06:00
release-fleetd-chrome.yml Updated fleetd-chrome to use non-beta location. (#16295) 2024-01-24 11:10:24 -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-fleetd-chrome.yml fleetd-chrome unit tests (#15918) 2024-01-04 21:41:24 -06:00
test-go.yaml Test DB migrations with Percona XtraDB MySQL server 5.7.25 (#16320) 2024-01-29 14:21:37 -03: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 Fixed macOS MSI package -- using local wine and wix (#16307) 2024-01-30 11:08:21 -06:00
test-puppet.yml puppet module: prevent running match call if a preassignment failed (#17175) 2024-02-28 19:15:41 -03:00
test-website.yml require a specific node and yarn version (#17205) 2024-03-13 12:45:28 +00:00
test-yml-specs.yml Use go variable to set version in workflows (#14890) 2023-11-03 09:42:27 -05:00
test.yml require a specific node and yarn version (#17205) 2024-03-13 12:45:28 +00:00
tfvalidate.yml Pin all workflow actions versions by commit (#13462) 2023-08-31 12:09:21 -05:00
trivy-scan.yml Update trivy scan options (#17357) 2024-03-04 16:36:17 -06: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.