Repository navigation
ci: publish release images and charts through coder/ghcr-publisher - #32566
Merged
Merged
Conversation
GitHub grants package write per repository, so any workflow on any branch here could overwrite ghcr.io/coder/coder or the OCI charts with the repository's GITHUB_TOKEN. Releases now push to *-staging packages and dispatch coder/ghcr-publisher, the only repository that can write the public ones. It copies each digest only after verifying this workflow attested it, on the release branch, from the tagged commit. - Images, the base image and the OCI charts go to the staging packages. The charts get their own attestations (manifest digests). - Attestations the promotion depends on now fail the release. - The final image builds on the fresh base image by digest. - latest is moved by the publisher; the latest SBOM asset is dropped (same image). - docker-base.yaml publishes coder-base-preview, the base for non-release builds. - verify-releases.md: releases since 2026-11-16 are built on release/X.Y, so --source-ref refs/tags/vX.Y.Z no longer matches. Co-Authored-By: Claude Opus 5.5 <[email protected]>
coder/ghcr-publisher moves coder-base:latest to the base of each new highest stable release, so non-release and local builds keep using it. docker-base.yaml now only checks on pull requests that Dockerfile.base builds; it no longer publishes or needs packages: write. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review fixes for the GHCR promotion: - Every staging digest now comes from the registry's response to the push (docker push, docker manifest push, depot, helm push), and the multi-arch index is built from per-arch digests. Nothing reads a staging tag back, so a writer moving a staging tag mid-release can't get their image attested. syft and cosign run against image@digest. - Each artifact gets a release attestation (https://coder.com/attestations/release/v1) stating the version, the commit the tag points to and the public package it is for. The attestation's own commit field is the dispatched branch head, which is not the released commit when an older commit is released. - A re-run accepts tags an earlier attempt already promoted. - The tagging and promotion App tokens are revoked right after use. - Image provenance attestations are best-effort again, as before; the publisher relies on the release attestations instead. - verify-releases.md: SOURCE_REF works for release candidates. Co-Authored-By: Claude Opus 5.5 <[email protected]>
coder-ghcr-dispatch has contents: write on coder/ghcr-publisher only, so the release no longer needs coder-release-publisher installed there. Co-Authored-By: Claude Opus 5.5 <[email protected]>
4 tasks done
kylecarbs
marked this pull request as ready for review
November 22, 2026 16:35
kylecarbs
added a commit
that referenced
this pull request
Nov 22, 2026
**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 newest `main-<10 digits>-<12 hex>` tag every 2 minutes, with no signature check. So a writer can push `main-9999999999-…` from a branch, and dogfood runs it within minutes and stays on it. **The fix.** It follows the release flow in #32566: - `build.yaml` pushes to **`coder-preview-staging`**. - Each per-arch digest comes from the registry's response to its own `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. - It signs a **preview attestation** (`https://coder.com/attestations/preview/v1`: commit, version tag, target). This step must succeed. - It dispatches **coder/ghcr-publisher** (`promote-preview.yaml`) with a `coder-ghcr-dispatch` token (`contents: write` on `ghcr-publisher` only), revokes the token, and waits for the version tag and, on main, the `main-<commit time>-<sha>` tag. - **The publisher** verifies the attestation came from a push run of `build.yaml` on `main` or `release/*` at that run's head commit. It then **derives every public tag from the verified commit**: the version, `main-<commit time>-<sha>`, `main`, `latest` and `release-X.Y`. - The derived tag matches today's `main-1795210592-ecc0850e369a` exactly, so dogfood's filter keeps working. - Rolling tags only move forward. - **Pruning** now targets the staging package. Public package storage is free, and only the publisher can write the public one. - **SBOM and provenance attestations** now run on the digest, once, instead of once per tag. **Prerequisites (all done 2026-11-22)** - [x] coder/ghcr-publisher#2 merged - [x] The `coder-ghcr-dispatch` App exists (coder/gcp#472, coder/github-org-terraform#206). The `ci-signing` environment has `CODER_GHCR_DISPATCH_APP_ID`, `CODER_GHCR_DISPATCH_APP_KMS_KEY` and `APP_KEYS_WORKLOAD_ID_PROVIDER`. - [x] `coder-preview-staging` exists: coder/coder **Admin** (pushes and prunes), `ghcr-publisher` **Read** - [x] `ghcr-publisher` has **Write** on `coder-preview` **After the first successful promotion:** set coder/coder to **Read** on `coder-preview`. Only then is the dogfood path closed. Pruning `coder-preview` moves to coder/ghcr-publisher (`prune-preview.yaml`, which has Admin on that package); this PR points the prune job here at `coder-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](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <[email protected]>
This was referenced Nov 22, 2026
sreya
approved these changes
Nov 22, 2026
kylecarbs
had a problem deploying
to
docs-preview
November 22, 2026 20:05 — 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.
GitHub grants package write access to a whole repository, not to a workflow, branch or environment. Today
ghcr.io/coder/coder,coder-baseand the OCI charts list coder/coder with Write, so any workflow on any branch here can requestpackages: writeand overwrite a release tag with this repository'sGITHUB_TOKEN. Thereleaseenvironment and the tag rulesets don't stop that. GHCR accepts neither App tokens nor OIDC, so the repository boundary is the only way to separate who publishes.With this change, releases push to
*-stagingpackages and trigger coder/ghcr-publisher, a locked repository that will be the only one with Write on the public packages. Before copying a digest, it verifies three things:release.yamlattested it,release/X.Y(ormainfor an RC), with the signer beingrelease.yamlat that same ref,vX.Y.Ztag points to.It copies by digest and never moves an existing version tag. It moves
latestonly to the highest stable version.Changes
coder-staging,coder-base-stagingandchart-staging/*..tgzattestations don't cover those digests.continue-on-error, because promotion depends on them.repository_dispatchis sent with acoder-ghcr-dispatchtoken (contents: writeonghcr-publisheronly).latestis no longer built here. The separate latest SBOM asset is dropped; it described the same image.Dockerfile.basebuilds for every platform. It no longer publishes, and no longer needspackages: write.ghcr.io/coder/coder-base:latest. coder/ghcr-publisher moves it to the base of each new highest stable release (roughly weekly for 2.39), instead of the Monday/Wednesday/Friday rebuild. So preview images and thecoder-preview:mainscan see Alpine updates about weekly, and aDockerfile.basechange reaches preview images at the next stable release. Release images always build a fresh base.release/X.Y, so the documented--source-ref refs/tags/vX.Y.Zand cosign identity fail for current releases.gh attestation verifyon v2.39.4 fails with the tag ref and passes withrefs/heads/release/2.39. v2.39.1 still passes with its tag. Cosign verifies v2.39.4 with the new identity.Review fixes (second commit set)
Two independent reviews (one functional, one adversarial) found the following, now fixed:
coder-staging:vXmid-release could get their image attested. Now every digest comes from the registry's response to our own push (docker push,docker manifest push, depot,helm push), the index is built from per-arch digests, and syft and cosign run onimage@digest. Tested against a local registry with Docker 29: each parsed digest matches what the registry stores, and the index contains exactly the pushed children.https://coder.com/attestations/release/v1) stating version, commit and target package, and the publisher requires it, plus an approvedreleaseenvironment on the run.SOURCE_REFis now correct for RCs (checked in bash and PowerShell).Image provenance attestations are best-effort again, as before; the publisher relies on the release attestations instead.
Prerequisites (all done 2026-11-22)
ghcr-publisherRead set under Manage Actions access:coder-staging,coder-base-staging,chart-staging/coder,chart-staging/coder-provisioner,chart-staging/coder-ai-gateway.coder-ghcr-dispatchApp exists and is installed onghcr-publisheronly (coder/gcp#472, coder/github-org-terraform#206), andCODER_GHCR_DISPATCH_APP_IDandCODER_GHCR_DISPATCH_APP_KMS_KEYare set in thereleaseenvironment.coder-release-publisheris uninstalled fromghcr-publisher.After merge
release.yaml.Tested:
🤖 Generated with Claude Code