obs: buildinfo package + Dockerfile ldflags for commit_sha (track 1/8)#39
Merged
Conversation
…k 1/8) - Dockerfile: ARG GIT_SHA / BUILD_TIME / VERSION, passed into `go build -ldflags -X instant.dev/common/buildinfo.X=...` so the resulting api binary stamps its own commit on every log line and /healthz response. - Makefile: docker-build target updated to `cd ..` first (since the Dockerfile assumes repo-root as build context per CLAUDE.md) and forwards --build-arg from `make` vars defaulting to `git rev-parse --short HEAD`. - New cmd/smoke-buildinfo helper + `make smoke-buildinfo` target builds with override values and asserts they appear at runtime — CI regression gate for the ldflag path. Companion changes: - common adds buildinfo package (InstaNode-dev/common#2) - worker adds matching Dockerfile/Makefile (InstaNode-dev/worker#7) - provisioner adds matching Dockerfile/Makefile (InstaNode-dev/provisioner#5) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
Track 1 of 8 in the observability rollout. Wires the api's Docker build to inject
instant.dev/common/buildinfovars at link time so every log line and/healthzresponse carries the actual commit_id of the running pod (instead of the current "dev" sentinel).ARG GIT_SHA / BUILD_TIME / VERSION, passed intogo build -ldflags -X instant.dev/common/buildinfo.X=....docker-buildnow runscd ..first (the Dockerfile assumes repo-root as build context per CLAUDE.md) and forwards--build-argfrommakevars defaulting togit rev-parse --short HEAD.cmd/smoke-buildinfo+make smoke-buildinfotarget builds with override values and asserts they appear at runtime — a CI regression gate for the ldflag path.Companion PRs (must merge before this can build green in CI):
Also updates
CLAUDE.mdat the InstaNode root to document the new docker build commands (passed as a sibling diff — that file is outside any git repo).Test plan
go build ./...green.make test-unit— every package except the pre-existinginternal/plansfailure (unrelated to this PR; see master commit c4cb536) is green. 15 packages pass, 1 pre-existing failure (freetier rename).make smoke-buildinfoprintssmoke-buildinfo: OK (GitSHA=smoke-sha BuildTime=smoke-time Version=smoke-ver).go build -ldflags \"-X instant.dev/common/buildinfo.GitSHA=test123 ...\" -o /tmp/smoke ./cmd/smoke-buildinfo && /tmp/smoke→GitSHA=test123 BuildTime=2026-05-12T00:00:00Z Version=v9.9.9.Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com