Skip to content

fix(ci): restore toolchain pin on main + guard sync-pin-on-pr against protected branches - #1309

Merged
Wikid82 merged 2 commits into
mainfrom
fix/restore-toolchain-pin-main
Sep 8, 2026
Merged

Wikid82 merged 2 commits into
mainfrom
fix/restore-toolchain-pin-main

Conversation

@Wikid82

@Wikid82 Wikid82 commented Sep 8, 2026

Copy link
Copy Markdown
Owner

Unblocks mainverify-toolchain-pin is currently red on every PR

Fix 1 (commit 1): restore the toolchain pin

6f38be5c ("chore(docker): sync toolchain image pin to
caddy-crowdsec-9eb9862f44b9e769"), authored by github-actions[bot] at
07:51 UTC, was pushed directly to main. It is toolchain-image.yml's
sync-pin-on-pr job running on the bot-authored main -> development
auto-propagation PR #1307: that job checks out
github.event.pull_request.head.ref — which for a propagation PR is main
recomputes the toolchain key against the merge ref (which pulls in
development's c32e611a gRPC 1.83.2 bump, a toolchain-key input) and commits
the two-line pin bump onto the head branch.

main's actual recipe still has GRPC_VERSION=1.83.1, whose key is
caddy-crowdsec-1efe7f19fa52a512. The pin now on main points at the
gRPC-1.83.2 key, so scripts/verify-toolchain-pin.sh fails everywhere.

This commit reverts 6f38be5c exactly (two ARG lines), restoring:

ARG value
CHARON_TOOLCHAIN_TAG caddy-crowdsec-1efe7f19fa52a512
CHARON_TOOLCHAIN_DIGEST sha256:6575f4c6a9f76074870c64df9dd4c9ebee812342f37f52ae5ef8f511ba9f8f00

This is the pair set at c0ee1195, CI-green at e3b76d04, and the digest
#1300's docker-build actually pulled
(#17 [toolchain-prebuilt] FROM …@sha256:6575f4c6…).

Verified on this branch:

  • bash scripts/toolchain-key.shcaddy-crowdsec-1efe7f19fa52a512 (matches restored TAG)
  • docker buildx imagetools inspect ghcr.io/wikid82/charon-toolchain:caddy-crowdsec-1efe7f19fa52a512sha256:6575f4c6a9f76074870c64df9dd4c9ebee812342f37f52ae5ef8f511ba9f8f00 (matches restored DIGEST)

Fix 2 (commit 2): stop sync-pin-on-pr from ever pushing to a long-lived branch

The job's only guard was github.actor != 'github-actions[bot]', which did
not fire here — the propagation PR's pull_request event runs under a
non-bot actor even though the PR is bot-authored with head ref main. Added to
the job if::

  • refuse any protected head ref outright — main / development / nightly /
    feature/beta-release (this job has no business rewriting a long-lived branch
    in place);
  • also skip when the PR author is github-actions[bot]
    (github.event.pull_request.user.login), not just the triggering actor;
  • existing actor guard retained.

Legitimate toolchain-key moves on development remain handled by the
open-bump-pr job (a reviewed bot PR), which is unchanged.

No in-tree harness asserts on workflow if: guards (bats covers the scripts,
not the YAML); actionlint passes. A yq-based assertion could be added later.

Relationship to other in-flight PRs

  • #1306 (integration-test consolidation) already squash-merged to main as 255a23df — unaffected by this.
  • #1308 (integration image artifact retention 1d → 3d) is a separate tiny follow-up, also based on main; it will go green once this PR lands and it is rebased.

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

codecov Bot commented Sep 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@github-advanced-security

Copy link
Copy Markdown
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:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

✅ Supply Chain Verification Results

PASSED

📦 SBOM Summary

  • Components: 1769

🔍 Vulnerability Scan

Severity Count
🔴 Critical 0
🟠 High 0
🟡 Medium 0
🟢 Low 0
Total 0

📎 Artifacts

  • SBOM (CycloneDX JSON) and Grype results available in workflow artifacts

Generated by Supply Chain Verification workflow • View Details

@Wikid82
Wikid82 merged commit 2316e0f into main Sep 8, 2026
55 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants