Repository navigation
ci: authenticate to ghcr.io so the validate job's pulls are not anonymous - #607
Merged
Merged
Conversation
…mous The probe step pulls every pinned image in every stack on every pull request — about six minutes of registry traffic, four of them for stacks/sensitive alone. Twice that volume tripped ghcr.io's rate limit on diffs that were Markdown only, and on 2026-09-21 the retry in check_compose_health.py fired all three of its pauses and the fourth attempt still failed. More backoff is not the lever; fewer anonymous requests is. ghcr.io limits by the identity asking, and an anonymous pull from a runner is identified by an egress IP shared with everything else on it. GITHUB_TOKEN is scoped to the run and, with the packages: read added here, to reads — which is all a pull needs. A plain docker login rather than an action, so nothing new has to be pinned. The step cannot fail the job. A login that does not happen — a fork's restricted token, a registry outage — leaves the pulls anonymous, which is where they already were, and every check below still fails loudly on an image it cannot fetch. Hard-failing would add a second way for CI to go red for a reason no diff can cause, which is the thing being fixed. Nothing weakens: --probe stays unconditional, still fails rather than skips without a daemon, and still pulls and execs inside every image. Docker Hub is untouched — separate quota, separate decision, nothing has failed there. Refs #602 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wfbt4PLuuFhJY97LGjrZ89
This was referenced Sep 22, 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.
What changed
.github/workflows/ci.yml, two edits and nothing else:permissions:gainspackages: read. Reads only; nothing here writes a package.validatejob gains adocker login ghcr.iostep, immediately after checkout so every later step benefits.This is option 1 of #602. Options 2 and 3 there — caching pulled images, and tuning the backoff — are deliberately not in this PR.
Why
The probe step pulls every pinned image in every stack on every pull request: about six minutes of registry traffic, four of them for
stacks/sensitivealone. Twice that volume tripped ghcr.io's per-minute limit on diffs that were Markdown only, and on 2026-09-21check_compose_health.py'sPULL_RETRY_PAUSESfired all three of its pauses — 5 s, 20 s, 60 s — and the fourth attempt failed anyway. More backoff is not the lever. Fewer anonymous requests is.ghcr.io rate-limits by the identity asking, and an anonymous pull from a GitHub runner is identified by an egress IP shared with everything else running on it.
GITHUB_TOKENis scoped to this run and to reads, which is all a pull needs.A plain
docker login, not an action — so this adds no third-party dependency to pin, which matters in a repository whosecheck_image_pins.pyexists to keep pins in one place.What it deliberately does not do
It cannot fail the job. A login that does not happen — a fork's restricted token, a registry outage — leaves the pulls anonymous, which is exactly where they already were, and every check below still fails loudly on an image it cannot fetch. Hard-failing here would add a second way for CI to go red for a reason no diff can cause, which is the thing #602 is about. The failure path emits two
::warning::lines rather than passing silently.Nothing is weakened.
--probestays unconditional; it still fails rather than skips when there is no daemon, and it still pulls and execs inside every pinned image. That property is the one #602 explicitly protects, quoting this file: "scripts/validate.shmay honestly skip it on a host without docker; CI may not." Adocs/**path filter would have violated it — this does not.Docker Hub is untouched. Separate quota, separate decision, and nothing has failed there.
Local runs are unchanged.
scripts/validate.shuses whatever credentials the operator's docker already has; authentication is environment-specific, not a check, so this is not the CI/local drift the rest of this file works to prevent.Blast radius
One workflow file. No host, no service, no stack, no script. The change is inert unless a step pulls from ghcr.io.
secrets/*.sops.yaml—GITHUB_TOKENis minted per run by Actions and is not stored anywhereThe token is passed through
env:and piped via--password-stdin, so it is not in a command line or an interpolatedrun:string.github.actoris likewise read fromenv:rather than interpolated into the script.Verification
Run locally after installing the linters this container was missing, because this diff is YAML and the last several were not — "no YAML changed" was doing the work in earlier PRs and cannot here:
./scripts/lint.sh→ yamllint PASS, markdownlint-cli2 PASS, shellcheck PASS, actionlint PASS, delegation check PASS. Only editorconfig-checker skipped (needs a docker daemon); its three rules for this file — final newline, no trailing whitespace, spaces not tabs — were checked by hand against the diff and are clean.run:block's shell and flags${{ }}interpolation into scripts. Clean.python3 scripts/check_image_pins.py→image pins OK — 42 docker run/pull/create invocation(s) across 14 file(s).docker loginis not arun/pull/create, so it is correctly outside that parser's scope.python3 scripts/check_docs.py→docs OK — 10 assertions.permissionsreads{'contents': 'read', 'packages': 'read'}.What cannot be verified from here: that an authenticated pull actually clears the limit. That is only observable on a runner, and the honest test is the next few PRs not going red the same way. If one does, #602 stays open and option 2 — caching — is next.
What remains on #602
Its "done when" has three parts; this closes one. Still open: image caching between runs, and a fixture covering the retry path so the
toomanyrequestshandling cannot regress silently.🤖 Generated with Claude Code
https://claude.ai/code/session_01Wfbt4PLuuFhJY97LGjrZ89
Generated by Claude Code