fix(ci): restore toolchain pin on main + guard sync-pin-on-pr against protected branches - #1309
Merged
Merged
Conversation
Reverts 6f38be5, a stray `sync-pin-on-pr` push from the bot-authored main -> development propagation PR #1307. That job checked out the PR head branch — which for a propagation PR IS `main` — recomputed the toolchain key against the merge ref (which pulls in development's gRPC 1.83.2 bump, a toolchain-key input) and committed the resulting `caddy-crowdsec-9eb9862f44b9e769` pin directly onto `main`. `main`'s actual recipe still has `GRPC_VERSION=1.83.1`, whose key is `caddy-crowdsec-1efe7f19fa52a512` (@ sha256:6575f4c6…), the digest #1300's docker-build actually pulled. The mismatch fails `verify-toolchain-pin` on every PR against `main`. Verified on this branch: - scripts/toolchain-key.sh -> caddy-crowdsec-1efe7f19fa52a512 - imagetools inspect <that tag> -> sha256:6575f4c6a9f76074870c64df9dd4c9ebee812342f37f52ae5ef8f511ba9f8f00 Claude-Session: https://claude.ai/code/session_01KXA4x9LrA2AsnLrvdHMZbS
The `sync-pin-on-pr` job in toolchain-image.yml pushes a recomputed TAG/DIGEST pin onto `github.event.pull_request.head.ref`. Its only guard against unwanted runs was `github.actor != 'github-actions[bot]'`, which does not fire for the main -> development auto-propagation PR (#1307): that PR's `pull_request` event runs under a non-bot actor even though the PR itself is bot-authored and its head ref is `main`. Result: the job recomputed the key against the propagation merge ref (which drags in development's gRPC bump) and committed `caddy-crowdsec-9eb9862f44b9e769` straight to `main`, breaking `verify-toolchain-pin` repo-wide (see the companion revert in this PR). Adds three guards to the job `if:`: - refuse any protected head ref (main / development / nightly / feature/beta-release) outright — this job has no business rewriting a long-lived branch in place; - also skip when the PR *author* is github-actions[bot], not just when the triggering actor is; - (existing actor guard retained). Legitimate toolchain-key moves on `development` are still handled by the `open-bump-pr` job, which opens a reviewed bot PR rather than pushing in place. No workflow-`if:` test harness exists in-tree (bats covers the scripts, not YAML guards); actionlint passes. Claude-Session: https://claude.ai/code/session_01KXA4x9LrA2AsnLrvdHMZbS
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
Contributor
✅ Supply Chain Verification Results✅ PASSED 📦 SBOM Summary
🔍 Vulnerability Scan
📎 Artifacts
Generated by Supply Chain Verification workflow • View Details |
This was referenced Sep 8, 2026
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.
Unblocks
main—verify-toolchain-pinis currently red on every PRFix 1 (commit 1): restore the toolchain pin
6f38be5c("chore(docker): sync toolchain image pin tocaddy-crowdsec-9eb9862f44b9e769"), authored by
github-actions[bot]at07:51 UTC, was pushed directly to
main. It istoolchain-image.yml'ssync-pin-on-prjob running on the bot-authoredmain -> developmentauto-propagation PR #1307: that job checks out
github.event.pull_request.head.ref— which for a propagation PR ismain—recomputes the toolchain key against the merge ref (which pulls in
development'sc32e611agRPC 1.83.2 bump, a toolchain-key input) and commitsthe two-line pin bump onto the head branch.
main's actual recipe still hasGRPC_VERSION=1.83.1, whose key iscaddy-crowdsec-1efe7f19fa52a512. The pin now onmainpoints at thegRPC-1.83.2 key, so
scripts/verify-toolchain-pin.shfails everywhere.This commit reverts
6f38be5cexactly (twoARGlines), restoring:CHARON_TOOLCHAIN_TAGcaddy-crowdsec-1efe7f19fa52a512CHARON_TOOLCHAIN_DIGESTsha256:6575f4c6a9f76074870c64df9dd4c9ebee812342f37f52ae5ef8f511ba9f8f00This is the pair set at
c0ee1195, CI-green ate3b76d04, and the digest#1300'sdocker-buildactually pulled(
#17 [toolchain-prebuilt] FROM …@sha256:6575f4c6…).Verified on this branch:
bash scripts/toolchain-key.sh→caddy-crowdsec-1efe7f19fa52a512(matches restored TAG)docker buildx imagetools inspect ghcr.io/wikid82/charon-toolchain:caddy-crowdsec-1efe7f19fa52a512→sha256:6575f4c6a9f76074870c64df9dd4c9ebee812342f37f52ae5ef8f511ba9f8f00(matches restored DIGEST)Fix 2 (commit 2): stop
sync-pin-on-prfrom ever pushing to a long-lived branchThe job's only guard was
github.actor != 'github-actions[bot]', which didnot fire here — the propagation PR's
pull_requestevent runs under anon-bot actor even though the PR is bot-authored with head ref
main. Added tothe job
if::main/development/nightly/feature/beta-release(this job has no business rewriting a long-lived branchin place);
github-actions[bot](
github.event.pull_request.user.login), not just the triggering actor;Legitimate toolchain-key moves on
developmentremain handled by theopen-bump-prjob (a reviewed bot PR), which is unchanged.No in-tree harness asserts on workflow
if:guards (bats covers the scripts,not the YAML);
actionlintpasses. Ayq-based assertion could be added later.Relationship to other in-flight PRs
#1306(integration-test consolidation) already squash-merged tomainas255a23df— unaffected by this.#1308(integration image artifact retention1d → 3d) is a separate tiny follow-up, also based onmain; it will go green once this PR lands and it is rebased.