Skip to content

build-push: move :latest on workflow_dispatch from main, not just push events#34

Open
stewartshea wants to merge 1 commit into
mainfrom
fix/workflow-dispatch-latest-tag
Open

build-push: move :latest on workflow_dispatch from main, not just push events#34
stewartshea wants to merge 1 commit into
mainfrom
fix/workflow-dispatch-latest-tag

Conversation

@stewartshea
Copy link
Copy Markdown
Contributor

@stewartshea stewartshea commented May 21, 2026

Summary

The tag-set case statement in .github/workflows/build-push.yaml only added the :latest alias for push events. Manually re-running the workflow on main via workflow_dispatch produced a fully-tagged canonical build but did not update the moving :latest pointer.

The bug

Before:

case "${{ github.event_name }}" in
  push)
    tags+=( "${repo_lc}:${sanitized_ref}" )
    if [ "${{ github.ref_name }}" = "main" ]; then
      tags+=( "${repo_lc}:latest" )
    fi
    ;;
  pull_request) ... ;;
  workflow_dispatch)
    tags+=( "${repo_lc}:${sanitized_ref}" )     # :latest NEVER appended
    ;;
esac

After: push and workflow_dispatch share an arm, so both apply the branch alias and :latest (gated on github.ref_name == "main" as before). pull_request stays separate.

Why it matters

  • Consumers pulling :latest directly were stuck on the last automatic push to main.
  • cc-catalog-svc and cc-registry-v2 use the canonical tag list (not :latest), so they now report a newer canonical tag while :latest still points at the older one — an inconsistency that surprised an operator when manually re-running a main build.

Compatibility

Trigger Before After
push to main <canonical> + :main + :latest unchanged
push to feature-x <canonical> + :feature-x unchanged
pull_request <canonical> + :pr-N unchanged
workflow_dispatch from main <canonical> + :main <canonical> + :main + :latest
workflow_dispatch from feature-x <canonical> + :feature-x unchanged

Only new behavior: workflow_dispatch on main now updates :latest.

Test plan

  • Merge to main
  • Run a manual workflow_dispatch on main and confirm :latest ends up pointing at the freshly-built canonical tag in GHCR
  • Confirm the existing automatic-push behaviour on main is unchanged

Companion PRs

This change ships in lockstep across all 6 RunWhen codecollection repos so the registry behaviour is consistent. The catalog-side handling (in runwhen-contrib/codecollection-registry PR ccv/git-mirror) makes the same fix less critical by sorting canonical tags on real built_at timestamps, but moving :latest correctly here is still the right thing to do for direct docker pull users and for visual consistency in GHCR.


Note

Low Risk
Low risk workflow-only change that adjusts Docker tag selection; the main impact is which GHCR tags get moved during manual runs.

Overview
Aligns image tagging between push and workflow_dispatch in build-push.yaml by sharing the same tag-selection branch.

Manual dispatch builds now apply the branch alias and will also move :latest when the ref is main, preventing :latest from lagging behind the newest canonical build.

Reviewed by Cursor Bugbot for commit b750815. Bugbot is set up for automated code reviews on this repo. Configure here.

…h events.

The tag-set case statement only added the ":latest" alias for `push`
events, so manually re-running the workflow on main via
workflow_dispatch produced a complete canonical-tagged build but did
NOT update the moving ":latest" pointer. Consumers that pull ":latest"
were stuck on the most recent automatic push, and the
cc-catalog-svc / cc-registry-v2 tag indexers (which use the canonical
tag list, not :latest, to pick the freshest build) ended up out of
sync with what humans saw at :latest.

Fix: merge the push and workflow_dispatch arms so both apply the
branch alias and the ":latest" alias (gated on `github.ref_name ==
"main"` as before). pull_request stays separate so PR builds never
move :latest.

No behavior change for: push (identical tag set), pull_request
(identical tag set), workflow_dispatch off non-main branches
(identical tag set — :latest still not applied). The only new
behavior is workflow_dispatch on main now updates :latest.

Co-authored-by: Cursor <cursoragent@cursor.com>
@stewartshea stewartshea requested a review from a team as a code owner May 21, 2026 18:11
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