Skip to content

ci: publish GHCR images through coder/ghcr-publisher - #8154

Draft
kylecarbs wants to merge 1 commit into
mainfrom
ci-ghcr-publisher
Draft

kylecarbs wants to merge 1 commit into
mainfrom
ci-ghcr-publisher

Conversation

@kylecarbs

Copy link
Copy Markdown
Member

The problem. GitHub grants package write per repository. ghcr.io/coder/code-server gives coder/code-server Write, so any workflow on any branch here (23 maintainers can push branches) can overwrite latest, 4.146.0 or any other tag. The release environment and tag rulesets don't apply to GITHUB_TOKEN.

What changes in the docker job. Docker Hub is unchanged.

  • Staging push: bake pushes the GHCR copy to ghcr.io/coder/code-server-staging and records each image's pushed digest (--metadata-file). No staging tag is ever read back.
  • One release attestation (https://coder.com/attestations/code-server-release/v1) covers all images. It states the version, the tag's commit, and each digest's public GHCR tags, computed from the same bake file with the public registry name, so they're exactly the tags pushed today. For v4.146.0, the map matches the 24 live tags across 7 images exactly.
  • Promotion: it dispatches coder/ghcr-publisher (promote-code-server.yaml) with a coder-ghcr-dispatch token (contents: write on ghcr-publisher only), revokes the token, and waits for the version tags.
  • What the publisher checks: the release is immutable and created by the release App (the same check as this workflow's verify job). Every digest must be covered by the attestation from publish.yaml at the tag's commit.
    • Version tags never move.
    • latest, debian, ubuntu and the other rolling tags move only for the highest stable version.
    • Re-runs keep the earlier build.

Before merge (draft until then)

  • coder/ghcr-publisher#2 merged
  • The coder-ghcr-dispatch App exists (coder/gcp#472, coder/github-org-terraform#206). The release environment has CODER_GHCR_DISPATCH_APP_ID and CODER_GHCR_DISPATCH_APP_KMS_KEY; APP_KEYS_WORKLOAD_ID_PROVIDER is already there.
  • code-server-staging exists: coder/code-server Write, ghcr-publisher Read
  • ghcr-publisher has Write on code-server

After the next release promotes successfully: set coder/code-server to Read on ghcr.io/coder/code-server.

actionlint and shellcheck are clean. zizmor's findings on this file (1 cache-poisoning, 4 artipacked) are the same as on main.

🤖 Generated with Claude Code

GitHub grants package write per repository, so any workflow on any
branch here could overwrite ghcr.io/coder/code-server, including
latest and version tags. The docker job now pushes the GHCR copy to
code-server-staging (Docker Hub is unchanged), signs one release
attestation stating the version, the tag's commit and each image's
public GHCR tags (from the same bake file), and dispatches
coder/ghcr-publisher with a coder-ghcr-dispatch token. The publisher
verifies the release and the attestation, then copies each image.
Version tags never move; rolling tags move only for the highest stable
version.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant