for #19106 This PR adds a Slack notification when the GitOps run fails in the dogfood-gitops workflow. Whenever the actual GitOps action fails, it should notify #help-dogfooding with a link to the failed action. Note that this will alert on both merges to main and scheduled runs, which I think we want. Also note that this is [currently failing on main](https://github.com/fleetdm/fleet/actions/runs/12154006118) so this alert will start going off daily until the issue is fixed 😶 ### > Note: this will need a new Slack incoming webhook for sending messages to #help-dogfooding, and a new `SLACK_G_HELP_DOGFOODING_WEBHOOK_URL` repo secret with the webhook URL. I tested this on a personal private repo just to make sure I got all the syntax right: <img width="422" alt="image" src="https://github.com/user-attachments/assets/74d188eb-5c03-471b-a5db-9f578a56e2ab"> |
||
|---|---|---|
| .. | ||
| config | ||
| build-and-check-fleetctl-docker-and-deps.yml | ||
| build-binaries.yaml | ||
| build-fleetd-base-pkg.yml | ||
| build-fleetd_tables.yaml | ||
| build-orbit.yaml | ||
| check-automated-doc.yml | ||
| check-tuf-timestamps.yml | ||
| code-sign-windows.yml | ||
| codeql-analysis.yml | ||
| dependency-review.yml | ||
| deploy-fleet-website.yml | ||
| deploy-vulnerability-dashboard.yml | ||
| docs.yml | ||
| dogfood-deploy.yml | ||
| dogfood-gitops.yml | ||
| fleet-and-orbit.yml | ||
| fleetctl-preview-latest.yml | ||
| fleetctl-preview.yml | ||
| fleetd-tuf.yml | ||
| generate-desktop-targets.yml | ||
| generate-nudge-targets.yml | ||
| generate-osqueryd-targets.yml | ||
| golangci-lint.yml | ||
| goreleaser-fleet.yaml | ||
| goreleaser-orbit.yaml | ||
| goreleaser-snapshot-fleet.yaml | ||
| integration.yml | ||
| pr-helm.yaml | ||
| README.md | ||
| release-fleetctl-docker-deps.yaml | ||
| release-fleetd-base.yml | ||
| release-fleetd-chrome-beta.yml | ||
| release-fleetd-chrome.yml | ||
| release-helm.yaml | ||
| render-deploy.yml | ||
| scorecards-analysis.yml | ||
| test-bulk-operations-dashboard-changes.yml | ||
| test-db-changes.yml | ||
| test-fleetd-chrome.yml | ||
| test-go.yaml | ||
| test-js.yml | ||
| test-native-tooling-packaging.yml | ||
| test-packaging-build-docker-deps.yml | ||
| test-packaging.yml | ||
| test-puppet.yml | ||
| test-vulnerability-dashboard-changes.yml | ||
| test-website.yml | ||
| test-yml-specs.yml | ||
| tfvalidate.yml | ||
| trivy-scan.yml | ||
| tuf-update-timestamp.yaml | ||
| update-certs.yml | ||
| update-osquery-versions.yml | ||
| verify-fleetd-base.yml | ||
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.