Skip to content

fix(build): tag images by version and major.minor instead of latest - #632

Open
stevapple wants to merge 1 commit into
modelpack:mainfrom
stevapple:fix/image-tag-semver
Open

fix(build): tag images by version and major.minor instead of latest#632
stevapple wants to merge 1 commit into
modelpack:mainfrom
stevapple:fix/image-tag-semver

Conversation

@stevapple

Copy link
Copy Markdown
Contributor

Follow-up to #631, addressing @chlins's review comment about :latest being overwritten by every v* tag.

Rather than making :latest smarter, this drops it. Before 1.0 a floating latest is actively hazardous: every 0.x minor is allowed to break compatibility, so anything that pulls modctl:latest silently changes behaviour from one release to the next. What it is really useful for — "track this line without pinning every patch" — is served better by a moving {{major}}.{{minor}} tag, which in 0.x maps exactly onto the compatibility boundary.

Changes

  • Image tags now come from docker/metadata-action with two semver patterns: {{version}} for the immutable tag, and {{major}}.{{minor}} as the moving tag for a release line.
  • flavor: latest=false keeps the action from adding latest on its own (its default is latest=auto).
  • labels: ${{ steps.meta.outputs.labels }} comes along with the action, and org.opencontainers.image.source is what links the GHCR package back to this repository.

Nothing needs to consult the rest of the tag history: {{major}}.{{minor}} only ever moves within its own line, so a patch published on an older line updates that line alone and leaves newer ones untouched. Pre-releases never move a shared tag at all — the action only extends {{version}} for them.

Resulting tags

Pushed tag Image tags
v0.3.0 0.3.0, 0.3
v0.2.3 (patch on an older line) 0.2.3, 0.2
v1.0.0-rc.1 (pre-release) 1.0.0-rc.1
v0.2.1-cnai (variant tag) 0.2.1-cnai

Behavioral change worth confirming

{{version}} strips the v prefix, so images become ghcr.io/modelpack/modctl:0.3.0 where the merged workflow would have pushed :v0.3.0. No release has been cut since #631 merged, so nothing already published is affected either way. This is what {{major}}.{{minor}} produces anyway and what most images conventionally use.

Testing

The four rows in the table above are actual output from docker/metadata-action v6.2.0 run against these inputs, and both pre-release forms this repository uses (-rc.N and the -cnai variant) correctly produce only their exact version.

Every v* tag pushed :latest, so a patch released on an older line or
a pre-release tag would move it backwards. Rather than making :latest
smarter, drop it: before 1.0 every minor is allowed to break
compatibility, so a floating latest silently carries consumers across
compatibility boundaries. A moving {{major}}.{{minor}} tag lands
exactly on that boundary in 0.x and serves the same purpose.

Tags now come from docker/metadata-action with {{version}} and
{{major}}.{{minor}}. flavor: latest=false is required because the
action would otherwise add latest on its own, its default being
latest=auto. Nothing has to consult the rest of the tag history: a
patch published on an older line moves only its own line, and
pre-releases only ever extend {{version}}, never a moving tag.

The labels output is wired through as well, since
org.opencontainers.image.source is what links the GHCR package back
to this repository.

Note that {{version}} strips the v prefix, so images are tagged
:0.3.0 rather than :v0.3.0. No release has been cut since modelpack#631, so
nothing already published is affected.

Signed-off-by: YR Chen <stevapple@icloud.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
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