Repository navigation
ci(runner): bump the embedded actions runner automatically - #212
Open
luthermonson wants to merge 1 commit into
Open
luthermonson wants to merge 1 commit into
luthermonson wants to merge 1 commit into
Conversation
ephemerd embeds a pinned actions/runner. GitHub deprecates old runner versions and then refuses their connections, so a stale pin silently stalls every job on a pool (the macOS pool once ran zero jobs for a week). The last bump came from an outside contributor; nothing on our side watched for it. Add .github/workflows/runner-bump.yml, a daily (and dispatchable) job on GitHub-hosted ubuntu-latest that compares the newest non-draft, non-prerelease actions/runner release with RunnerVersion and, when it is newer, opens or updates a PR on the fixed branch bot/actions-runner-bump. The edit is done by mage/runnerbump, a stdlib-only Go program, not sed. It rewrites RunnerVersion, the actions/runner pin comment, the five runner pinnedSHA256 entries and ARG RUNNER_VERSION in the three CI runner-image Dockerfiles, then gofmts. Every site must match exactly once and no trace of the old version may survive, so a refactor of download.go fails the bump instead of half-editing it. Checksums come from the release API's per-asset digest (download-and-hash when one is missing), cross-checked against the release notes' BEGIN SHA markers; a missing archive or a disagreement fails. Run against the pre-#183 tree with -version 2.337.0 it reproduces #183's download.go and Linux Dockerfile byte for byte. It also syncs the macOS and Windows image ARGs, which were left at 2.333.1 by #97 and #183. The job uses a GitHub App token when BOT_APP_CLIENT_ID / BOT_APP_PRIVATE_KEY are configured (so CI runs on the PR) and falls back to GITHUB_TOKEN.
|
ePHPm Preview — deployed (health check pending)
Preview updates automatically on each push to this PR. |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
ephemerd embeds a pinned
actions/runner. GitHub deprecates old runner versions and then refuses their connections, so a stale pin silently stalls every job on that pool. The macOS pool once ran zero jobs for 7 days this way. The last bump (#183) came from an outside contributor, and nothing on our side was watching for new releases.actions/runnerv2.338.0 is already out, so the first run after merge should open a bump PR.What
.github/workflows/runner-bump.ymlruns daily at 07:23 UTC and onworkflow_dispatch(optionalversioninput). It runs on GitHub-hostedubuntu-latest, so it never takes a self-hosted fleet slot.actions/runnerrelease (/releases/latest, flags re-checked) and compares it toRunnerVersionas numeric semver.go run ./mage/runnerbumpedits the pins. The job then runsgofmt -l mage/andgo build ./mage/..., commits, and opens or updates a PR on the fixed branchbot/actions-runner-bump.main, and the existing PR is retitled and re-described. No second PR is opened.concurrency: runner-bump(no cancel). The workflow getscontents: writeandpull-requests: write, and nothing else.mage/runnerbumpis a small Go program that uses only the standard library. It does the edits; no sed is involved.RunnerVersion.// GitHub Actions runner (actions/runner vX)comment.actions-runner-{linux-x64,linux-arm64,win-x64,osx-x64,osx-arm64}entries inpinnedSHA256.ARG RUNNER_VERSIONinimages/runner-ci-{linux,macos,windows}/Dockerfile.gofmton the result to realign the map.download.gotherefore fails the bump loudly instead of producing a half-edited file.digest(sha256:...).BEGIN SHAmarkers when those exist. A disagreement fails the bump; the notes are never the only source.-version,-check,-root,-release-json(for offline testing) and-body-out. It can be run by hand:go run ./mage/runnerbump.main_test.gocovers the rewrite, unknown-shape refusal, a missing asset, a notes/digest mismatch, the Dockerfile rewrite and numeric semver.mage/download/download.go: only the checksum-source comment changed, to point at the digest source and the bot.Token: needs a GitHub App to be fully hands-off
The ephpm org has "Allow GitHub Actions to create and approve pull requests" switched off, for this repo and for ephpm/ephpm (
can_approve_pull_request_reviews: false). TheGITHUB_TOKENhouse pattern (sdk-bump.yml/turso-pin-watch.yml) therefore cannot open PRs: ephpm/ephpm's SDK Bump failed withGitHub Actions is not permitted to create or approve pull requests. Default-token PRs would not trigger CI anyway. So the job uses a GitHub App installation token when one is configured:BOT_APP_CLIENT_IDBOT_APP_PRIVATE_KEYThe App needs Contents: read & write and Pull requests: read & write, and must be installed on
ephpm/ephemerd. Don't reuse the ephemerd runtime App's key. Org-level names let ephpm/ephpm's bump workflows use the same App later.Without the App, the job falls back to
GITHUB_TOKEN. It still pushesbot/actions-runner-bump, then fails with an::error::that gives a compare link and both fixes. The alternative fix is to enable the Actions setting above, but CI would then not run on the bot PR until someone closes and reopens it.Other version references (grep for the version and
2.33x)download.go(as above).images/runner-ci-linux/Dockerfile.images/runner-ci-{macos,windows}/Dockerfile. These were left at2.333.1by fix(runner): select highest embedded runner version, bump to 2.335.1 #97 and fix(runner): bump embedded actions runner to 2.337.0 #183, so they pre-cache a stale archive. The bot sets the ARG whatever its old value was, so the first bump brings them back in step. The cost is nothing extra: anydownload.gochange already triggersbuild-images.ymlfor all images.pkg/runner/runner_test.go: synthetic version-parse and compare fixtures.pkg/runtime/runtime_test.go: a/data/runners/2.333.1-linuxpath fixture.pkg/runner/runner.go: example comments.pkg/vm/macosvm_darwin.go(two sites) andpkg/vm/macos_install_darwin.gopick the firstrunners/*dir that has arun.sh. Those dirs are named<ephemerd-version>-<os>and old ones are never pruned, so a macOS host can keep injecting an older ephemerd's runner after an upgrade.pkg/runner.findTarballalready selects the highest version; these globs should too.Validation
c03587f^) with-version 2.337.0and the live API. The outputdownload.goand Linux Dockerfile are byte-identical to fix(runner): bump embedded actions runner to 2.337.0 #183, and all five digests match fix(runner): bump embedded actions runner to 2.337.0 #183's.bump=false.-check: reports the bump without editing.-release-json):win-x64removed: fails and names the asset; tree untouched.prerelease: true: refused.go test ./mage/runnerbumppasses;go build ./mage/...andCGO_ENABLED=0 GOOS=linux go vet ./mage/...are clean.create-github-app-token@v3'sclient-idinput. actionlint's bundled metadata predates v3, whoseaction.ymldefinesclient-idand deprecatesapp-id.After merge
The workflow can only be dispatched once it is on
main: