Repository navigation
ci: publish coder-preview through coder/ghcr-publisher - #32571
Merged
Merged
Conversation
Any workflow on any branch here could push ghcr.io/coder/coder-preview, and dogfood's Flux deploys the newest main-<time>-<sha> tag every two minutes without verifying it. A writer could push main-9999999999-x and dogfood would run it within minutes. build.yaml now pushes to coder-preview-staging, with digests taken from the registry's response to each push and the index built from them, attests the build with a preview attestation (commit, version tag, target), and dispatches coder/ghcr-publisher with a coder-ghcr-dispatch token. The publisher verifies the attestation and the push run, then derives every public tag from the verified commit. The prune job now prunes the staging package. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ammario
approved these changes
Nov 22, 2026
kylecarbs
had a problem deploying
to
docs-preview
November 22, 2026 16:42 — with
GitHub Actions
Failure
This branch had an error being 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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
The problem. Any workflow on any branch here can push
ghcr.io/coder/coder-preview, because GitHub grants package write per repository. coder/dogfood's Flux (coder-image/resourcesetinputprovider-coder-preview.yaml) deploys the alphabetically newestmain-<10 digits>-<12 hex>tag every 2 minutes, with no signature check. So a writer can pushmain-9999999999-…from a branch, and dogfood runs it within minutes and stays on it.The fix. It follows the release flow in #32566:
build.yamlpushes tocoder-preview-staging.docker push, and the index is built from those digests. No staging tag is read back, which closes a race where a writer swaps a tag mid-build.https://coder.com/attestations/preview/v1: commit, version tag, target). This step must succeed.promote-preview.yaml) with acoder-ghcr-dispatchtoken (contents: writeonghcr-publisheronly), revokes the token, and waits for the version tag and, on main, themain-<commit time>-<sha>tag.build.yamlonmainorrelease/*at that run's head commit. It then derives every public tag from the verified commit: the version,main-<commit time>-<sha>,main,latestandrelease-X.Y.main-1795210592-ecc0850e369aexactly, so dogfood's filter keeps working.Prerequisites (all done 2026-11-22)
coder-ghcr-dispatchApp exists (coder/gcp#472, coder/github-org-terraform#206). Theci-signingenvironment hasCODER_GHCR_DISPATCH_APP_ID,CODER_GHCR_DISPATCH_APP_KMS_KEYandAPP_KEYS_WORKLOAD_ID_PROVIDER.coder-preview-stagingexists: coder/coder Admin (pushes and prunes),ghcr-publisherReadghcr-publisherhas Write oncoder-previewAfter the first successful promotion: set coder/coder to Read on
coder-preview. Only then is the dogfood path closed. Pruningcoder-previewmoves to coder/ghcr-publisher (prune-preview.yaml, which has Admin on that package); this PR points the prune job here atcoder-preview-staging.actionlint and zizmor are clean. The push and index steps were rehearsed on a local registry, where the parsed digests matched what the registry stored.
🤖 Generated with Claude Code