feat(github-actions): publish coder-workspace images to GHCR on release - #878
Open
ppat wants to merge 3 commits into
Open
feat(github-actions): publish coder-workspace images to GHCR on release#878ppat wants to merge 3 commits into
ppat wants to merge 3 commits into
Conversation
Adopts ppat/github-workflows build-docker-image.yaml v6.0.0 (currently unmerged at ppat/github-workflows#615 -- the pin below targets that PR's head SHA and must be repointed to the v6.0.0 tag once it merges). - source_git_ref -> git_ref (input renamed in v6, breaking) - image_id output removed in v6; unused here, no change needed - new ghcr_repository input wired to publish only on real releases, gated the same way publish-template already gates its own coder template push (released_version != 'v0.0.0'), so PR/dry-run/ workflow_dispatch test builds never publish to GHCR - publish-image now declares job-level `packages: write` -- required unconditionally by the called workflow even though this repo also publishes to a private registry, because a job's `permissions:` block cannot be made conditional; omitting it fails the whole workflow at load time, not just the GHCR step
…s fixed head The prior pin predated a fix for a malformed-repository input that left the publish gate on while warning it was disabled, producing a broken image reference and a hard failure. Repoint to the current head so this build validates against the fixed behaviour. The release-semantic.yaml pin is untouched.
Owner
Author
|
Repointed the |
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.
Summary
Adopts
ppat/github-workflowsbuild-docker-image.yamlv6.0.0 for thepublish-imagejob in.github/workflows/release.yaml, and enables publishing the releasedcoder-workspaceimage toGHCR (
ghcr.io/ppat/coder-workspace) alongside the existing private-registry push.v6.0.0 is not merged yet. This PR pins to the head SHA of the still-open
ppat/github-workflows#615(a6829b4b819f7c39adabf277c7d87a1e663c186d). Do not merge this PRuntil that PR merges and a
v6.0.0tag exists — at that point the pin comment should be updatedto reference the tag SHA instead of the PR-branch SHA (same content, since the PR branch doesn't
move once merged, but the comment currently says so explicitly as a merge blocker).
v6 breaking changes and how this PR adapts to them
source_git_refrenamed togit_ref. Updated the one call site.image_idoutput removed. Verified viagit grep -n image_id— this repo never referencedit, so no follow-up needed.
New optional
ghcr_repositoryinput. No secrets required; GHCR authenticates with theambient
GITHUB_TOKEN. Wired conditionally:publish-imageruns unconditionally — on real releases and on PR/dry-run/workflow_dispatchtest builds — but GHCR should only receive real releases.
release-semantic.yaml(pinned hereat v5.0.1, unchanged) emits the literal sentinel
v0.0.0forreleased_versionon everynon-publishing path (PR event, or
workflow_dispatchwithtest_publish: true) and a realvX.Y.Zonly when it actually cuts a release. This mirrors the idiompublish-templatealreadyuses one job over (
released_version != 'v0.0.0'), so the two publish paths (GHCR image,Coder template) agree on what counts as "a real release."
Traced both branches:
dry_run: true→ release-semantic's dry-run path →released_version == 'v0.0.0'→
ghcr_repositoryevaluates to''→PUBLISH_GHCRis false → no GHCR push.workflow_dispatch,test_publish: false):dry_run: false→ an actualsemantic-releaserun →released_versionis a realvX.Y.Z→ghcr_repositoryevaluatesto
'ppat/coder-workspace'→ image published to GHCR.workflow_dispatchwithtest_publish: truealso resolves to the dry-run path above, so itdoes not publish either — correct, it's still a test run.
packages: writeis now required unconditionally by the called workflow'sbuild-imagejob, even for callers that never touch GHCR. Quoting the workflow's own comment (and the
failure mode it documents):
release.yamlhas no workflow-levelpermissions:block anywhere (all jobs run at the repodefault,
read), so this PR adds a job-level block onpublish-imageonly:create-releaseandpublish-templateare untouched —create-releaseauthenticates via aGitHub App token (
HOMELAB_BOT_APP_*secrets passed intorelease-semantic.yaml), notGITHUB_TOKEN, so it needs nocontents: write, and neither job touches GHCR.What this PR does NOT touch
Two
ppat/github-workflowspins exist in this file. Only thebuild-docker-image.yamlone (usedby
publish-image) is bumped. Therelease-semantic.yamlpin (used bycreate-release) is leftat
v5.0.1— unrelated to this change.Test coverage — what's actually exercised by this PR's own CI
This PR's own
pull_requesttrigger only exercises the non-publishing path:create-releaseruns withdry_run: true, soreleased_version == 'v0.0.0'andghcr_repositoryresolves to''—publish-imagestill runs (private-registry push, astoday), but the new GHCR branch of the conditional is not exercised by this PR's checks. The
real-release path (
ghcr_repositoryresolving non-empty and an image actually landing in GHCR)can only be exercised by an actual
workflow_dispatchrelease run after merge. What this PR's CIdoes prove: the workflow still loads and runs with the new
packages: writegrant in place (nostartup_failure), and the renamedgit_refinput is accepted.Local checks
pre-commit run --files .github/workflows/release.yaml— all hooks pass (yamllint, whitespace,etc.)
pre-commitnode envfails to resolve
@commitlint/ensure's subpath export under this environment's Node 26 (anenvironment issue reproducible even against a message copied verbatim from
CLAUDE.md's ownexample, not something introduced by this change). Header is 71 characters, well under the
120-char limit, type/scope are both in the allowed list. Relying on this repo's CI
lint-commit-messagesjob as the authoritative check.