fix: find the build's commit instead of demanding it be HEAD - #51
Merged
Conversation
The guard required the promoted digest to be tagged with the ref's HEAD sha. Build workflows carry paths filters, so any docs- or CI-only commit moves the branch without producing an image — and from then on the repo could not be released at all until someone happened to touch a build input. Topology hit this immediately: adding its release workflow is itself such a commit. Walk back from the ref instead and find the most recent commit whose per-commit tag carries this digest. That still proves the image came from this branch's history rather than a stale or foreign build, and it answers a question the old version never asked: WHICH commit is this image? The tag is then created on that commit, so a version names the code that is actually in it. One `crane ls` up front, then membership is a local grep — Topology already has 65 tags, and the alternative is a registry round trip per commit per tag form. Verified against the live registry both ways: HEAD-is-the-build resolves at 0 behind, and a CI-only commit on top resolves to the build 1 behind (the case that previously failed outright). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Found on first contact with a real repo, exactly where I expected the workflow to be wrong.
The bug
The guard demanded the promoted digest be tagged with the ref HEAD sha. But build workflows carry paths filters, so a docs- or CI-only commit moves the branch without producing an image. From that moment the repo is unreleasable until someone touches a build input — which is absurd, and Topology triggers it immediately: adding its release workflow is itself such a commit.
The fix
Walk back from the ref and find the most recent commit whose per-commit tag carries this digest. This keeps everything the old check bought — the image provably came from this branch, not a stale build or another branch — and answers a question the first version never asked: which commit is this image?
The git tag is then created on that commit rather than HEAD, so a version names code that is actually in it. Usually identical; when they differ, this is the honest one. The tag message and job log both record how many commits the ref moved on afterwards.
Also guards the multi-image case: images released together must resolve to the same build commit, or the release fails rather than quietly shipping a mismatched pair.
Cost
One
crane lsper image up front, then membership is a localgrep -Fxq. Topology already has 65 tags, so the naive alternative is a registry round trip per commit per tag form.Verified against the live registry
New
verify-depthinput (default 50) bounds the search; it needs to cover the gap between HEAD and the last commit that changed a build input.