fix(ci): wire the computed release version into the built binaries #55

Merged
rcsheets merged 1 commit from fix/version-wiring into main 2026-07-23 09:42:34 +00:00
Owner

The containerized builds report gllm unknown on the index page (and in /status and the gllm_server_info metric). Two independent breaks:

  1. The semver never reached the build. CI computes the release version in the "Set image tags" step, uses it to tag the image, and throws it away -- no build arg, no ldflags. The binary and the image tag were never connected.
  2. The SHA fallback was dead too. .dockerignore excludes .git (deliberately, for stale-artifact hygiene), so go build inside the container has no repo to stamp vcs.revision from, and BuildVersion() fell through to "unknown".

The fix threads the version through:

  • internal/engine/status.go: link-time buildVersion var; BuildVersion() prefers it, keeping the VCS-revision fallback for local make build.
  • Dockerfile / Dockerfile.cuda: ARG VERSION= injected via -ldflags -X.
  • build-push.yaml: both image builds pass --build-arg VERSION=${{ steps.tags.outputs.version }}.
  • Makefile: image/image-cuda pass git describe so local images report provenance instead of "unknown".

Both CPU and CUDA images get the plain version (no -cuda suffix) -- the backend is already a separate /status field and the flavor lives in the image tag. Dockerfile.cuda-prerelease is untouched (build-only canary, never pushed); the 13.4 GA probe inherits the empty ARG default harmlessly.

Verified: go vet/go build/engine tests pass; a scratch test run with the -X flag reports the injected version and without it falls back as before.

🤖 Generated with Claude Code

The containerized builds report `gllm unknown` on the index page (and in `/status` and the `gllm_server_info` metric). Two independent breaks: 1. **The semver never reached the build.** CI computes the release version in the "Set image tags" step, uses it to tag the image, and throws it away -- no build arg, no ldflags. The binary and the image tag were never connected. 2. **The SHA fallback was dead too.** `.dockerignore` excludes `.git` (deliberately, for stale-artifact hygiene), so `go build` inside the container has no repo to stamp `vcs.revision` from, and `BuildVersion()` fell through to `"unknown"`. The fix threads the version through: - `internal/engine/status.go`: link-time `buildVersion` var; `BuildVersion()` prefers it, keeping the VCS-revision fallback for local `make build`. - `Dockerfile` / `Dockerfile.cuda`: `ARG VERSION=` injected via `-ldflags -X`. - `build-push.yaml`: both image builds pass `--build-arg VERSION=${{ steps.tags.outputs.version }}`. - `Makefile`: `image`/`image-cuda` pass `git describe` so local images report provenance instead of "unknown". Both CPU and CUDA images get the plain version (no `-cuda` suffix) -- the backend is already a separate `/status` field and the flavor lives in the image tag. `Dockerfile.cuda-prerelease` is untouched (build-only canary, never pushed); the 13.4 GA probe inherits the empty `ARG` default harmlessly. Verified: `go vet`/`go build`/engine tests pass; a scratch test run with the `-X` flag reports the injected version and without it falls back as before. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fix(ci): wire the computed release version into the built binaries
All checks were successful
ci / test_and_build (pull_request) Successful in 23s
0cedf31b46
The index page (and /status, and gllm_server_info) reported "gllm
unknown" from the containerized builds: BuildVersion() only knew how to
read the Go toolchain's VCS stamp, but .dockerignore excludes .git from
the build context so there was nothing to stamp -- and the release
version CI computes was only ever used to tag the image, never passed
into the build.

Thread it through: a link-time buildVersion var in the engine package
(VCS revision stays as the fallback for local `make build`), a VERSION
build arg in both Dockerfiles, and CI passing its computed version to
both image builds. Local `make image`/`image-cuda` pass git describe so
they report provenance instead of "unknown" too.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Collaborator

Automated review by pr-reviewer v0.37.0 | Safety Check | Claude Sonnet 5 | tracking id r-61e18c-61f25d
This is an AI-generated review and may contain mistakes.

Status: Completed


⚠️ The primary review (Mistral Small) failed. The review below is from Claude Sonnet 5, which reviewed the same diff.

Verdict: LGTM — Straightforward, low-risk build/CI wiring fix with backward-compatible fallback logic and no security or breaking-change concerns.

The change is a straightforward, low-risk CI/build-wiring fix:

  • internal/engine/status.go: adds a package-level buildVersion var, overridable via -ldflags -X, with fallback to existing VCS-based logic. Logic is correct and backward compatible (empty string falls through to old behavior).
  • Dockerfiles: ARG VERSION= with empty default is safe — harmless if unset, matches stated intent.
  • build-push.yaml: adds --build-arg VERSION=... to both CPU and CUDA build invocations, sourced from the already-computed steps.tags.outputs.version. No secrets involved, straightforward plumbing.
  • Makefile: adds VERSION ?= $(shell git describe ...) with sane default and passes it through to local image builds.

No security concerns (no secrets, no injection vectors — version strings come from git tags/CI, not user input). No accidentally committed files. No breaking changes: the fallback path is preserved, so binaries built without the new ldflag continue to behave as before. Diff is small and matches the PR description precisely; nothing looks tacked on or suspicious.

Minor note: no new tests added for the status.go change, but the logic is trivial (string override with fallback) and this is acknowledged in the PR's own context notes.

*Automated review by [pr-reviewer](https://git.brooktrails.org/brooktrails/pr-reviewer) v0.37.0 | Safety Check | Claude Sonnet 5 | tracking id `r-61e18c-61f25d`* *This is an AI-generated review and may contain mistakes.* **Status:** ✅ Completed --- > ⚠️ The primary review (**Mistral Small**) failed. The review below is from **Claude Sonnet 5**, which reviewed the same diff. **✅ Verdict: LGTM** — Straightforward, low-risk build/CI wiring fix with backward-compatible fallback logic and no security or breaking-change concerns. The change is a straightforward, low-risk CI/build-wiring fix: - `internal/engine/status.go`: adds a package-level `buildVersion` var, overridable via `-ldflags -X`, with fallback to existing VCS-based logic. Logic is correct and backward compatible (empty string falls through to old behavior). - Dockerfiles: `ARG VERSION=` with empty default is safe — harmless if unset, matches stated intent. - `build-push.yaml`: adds `--build-arg VERSION=...` to both CPU and CUDA build invocations, sourced from the already-computed `steps.tags.outputs.version`. No secrets involved, straightforward plumbing. - `Makefile`: adds `VERSION ?= $(shell git describe ...)` with sane default and passes it through to local image builds. No security concerns (no secrets, no injection vectors — version strings come from git tags/CI, not user input). No accidentally committed files. No breaking changes: the fallback path is preserved, so binaries built without the new ldflag continue to behave as before. Diff is small and matches the PR description precisely; nothing looks tacked on or suspicious. Minor note: no new tests added for the status.go change, but the logic is trivial (string override with fallback) and this is acknowledged in the PR's own context notes.
rcsheets deleted branch fix/version-wiring 2026-07-23 09:42:35 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
brooktrails/gllm!55
No description provided.