This pull request introduces automation for keeping the Fleet macOS Safari update policy current, along with a new script for updating Safari on endpoints. The main changes include a new GitHub Actions workflow step to run an automated script that checks for the latest Safari versions, updates the policy YAML if needed, and creates a pull request with the changes. Additionally, a new endpoint script is added to perform Safari updates via `softwareupdate`. **Automation for Safari Policy Updates:** * Added `.github/scripts/dogfood-policy-updater-latest-safari.sh`, a script that fetches the latest Safari versions from the SOFA feed, compares them to the versions in `update-safari.yml`, updates the YAML if necessary, and automatically creates a pull request with reviewers assigned. * Updated `.github/workflows/dogfood-automated-policy-updates.yml` to add a step that runs the new Safari version update script as part of the workflow, using the required automation secrets. **Policy and Endpoint Script Enhancements:** * Added a new policy to `it-and-security/lib/macos/policies/update-safari.yml` that checks if the installed Safari version matches the latest for macOS 15 (Safari 18.6) and macOS 26 (Safari 26.1). * Introduced `it-and-security/lib/macos/scripts/update-safari.sh`, a script for endpoints that runs `softwareupdate` with the `--safari-only` flag, logging the outcome and requiring root privileges.
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.