ci: inject VERSION build-arg into docker image build#387
Merged
Conversation
The Dockerfile accepts ARG VERSION and bakes it into the binary via -X main.Version, which flows to the /version handler. The workflow never passed the build-arg, so published images defaulted to VERSION=dev and the runtime git fallback found no .git in the container, leaving the UI showing "vdev". Compute the version with git describe (same format the version handler parses, matching the Makefile) and pass it as a build-arg. Add a smoke-test guard that fails the build if the image reports version "dev".
✅ Deploy Preview for nebi-docs canceled.
|
viniciusdc
approved these changes
Jun 5, 2026
viniciusdc
left a comment
Contributor
There was a problem hiding this comment.
LGTM, the test addition trough the api request was a clever idea
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.
Published nebi images report their version as
dev, so the web UI showsvdev.Root cause
The runtime chain is correct:
-X main.Version->serve.go->server.Config.Version->handlers.Version->/version. The Dockerfile already acceptsARG VERSIONand bakes it via ldflags.The break is in CI: the
Build and maybe pushstep indocker.ymlnever passed aVERSIONbuild-arg, soARG VERSION=dev(the Dockerfile default) was used. The container ships no.git, so the handler's runtimegit describefallback also fails, leavingversion: "dev".Fix
git describe --tags --always --dirty(the exact formatinternal/api/handlers/version.goparses, and what theMakefilealready uses).build-args: VERSION=...todocker/build-push-action./versionreportsdev.Verification
Built the image locally with the build-arg and ran the smoke test:
{ "version": "0.12-rc3.dev+e8f6759", "commit": "e8f6759", ... }Previously this returned
"version": "dev".