Fix published image's version label to match resolve-version's output - #28
Merged
Merged
Conversation
org.opencontainers.image.version was showing "v1.2.1" (the raw release tag) instead of "1.2.1" — docker/metadata-action auto-derives that label from the git ref, and build-push-action's labels input always wins over the Dockerfile's own ARG IMAGE_VERSION LABEL for the same key. Override the label explicitly in the metadata-action step so it matches resolve-version's actual output.
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
The
v1.2.1published image'sorg.opencontainers.image.versionlabel readsv1.2.1(with the "v") instead of1.2.1.docker/metadata-actionauto-derives that label from the raw git ref (the release tag), anddocker/build-push-action'slabelsinput always wins over the Dockerfile's ownARG IMAGE_VERSIONLABELfor the same key — so the auto-derived value silently overrides ours.Fix: explicitly override the label in the
buildjob'smetadata-actionstep withresolve-version's actual output, so the two agree.Test plan
yaml.safe_load).docker inspect --format '{{json .Config.Labels}}'showsorg.opencontainers.image.version= the plain semver (e.g.1.2.2), notv1.2.2.Generated by Claude Code