build: stamp the version into the published Docker images - #33
Merged
Merged
Conversation
`ignis -version` in the ghcr.io/thd-spatial-ai/ignis image reported
"dev (commit none, built unknown)" because the image build never passed
the -ldflags -X that release.yml uses for the standalone binaries. A
deployed container could not say which release it was running.
- Both environment/*.dockerfile take VERSION, COMMIT and DATE build args
(defaulting to the same values internal/version hard-codes, so a plain
`docker build` and the dev compose path are unchanged) and pass them
to `go build` as -ldflags -X, matching release.yml.
- docker-publish.yml passes those args: VERSION from the image tag
(metadata-action's {{version}}, e.g. 0.5.0), COMMIT from github.sha,
DATE from a build-time timestamp.
- The version-line format moves from cmd/ignis into version.String() so
build_db can print it in its startup banner too; its test moves to
internal/version with it.
Verified locally: a stamped app image reports the real version, a
stamped build_db logs it in its banner, an unstamped build still reports
the hard-coded defaults.
Claude-Session: https://claude.ai/code/session_01JBfY6ZG2W52imgy2M1JGYo
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
Problem
ignis -versioninsideghcr.io/thd-spatial-ai/ignisreportsdev (commit none, built unknown). The image build (environment/ignis-app.dockerfile) never passed the-ldflags -Xthatrelease.ymluses for the standalone binaries, so a running container cannot report which release it is. Confirmed on the just-deployed0.5.0.Change
environment/*.dockerfiletakeVERSION,COMMIT,DATEbuild args and pass them togo buildas-ldflags -X, matchingrelease.yml. Defaults are the same valuesinternal/versionhard-codes, so a plaindocker buildand thedocker-compose.ymldev path are unchanged.docker-publish.ymlsupplies the args:VERSIONfrommetadata-action's{{version}}(the image tag, e.g.0.5.0— note this omits the leadingv, consistent with the published tags),COMMITfromgithub.sha,DATEfrom a build-step timestamp.cmd/ignisintoversion.String(), sobuild_dbprints it in its startup banner too. The format test moves tointernal/versionwith it.Verification (local)
ignis -version/build_dbbanner--build-arg VERSION=0.5.0 …0.5.0 (commit c2f8e2f…, built 2026-09-05T…)dev (commit none, built unknown)go build ./...,go vet ./...,go test ./...pass.Note
This takes effect on the next tag. To stamp the already-published
0.5.0images, re-run thePublish Docker imagesworkflow viaworkflow_dispatchon the tag after merge.https://claude.ai/code/session_01JBfY6ZG2W52imgy2M1JGYo