Skip to content

obs: buildinfo package + Dockerfile ldflags for commit_sha (track 1/8)#39

Merged
mastermanas805 merged 1 commit into
masterfrom
obs/obs-4-dockerfile-fresh
May 12, 2026
Merged

obs: buildinfo package + Dockerfile ldflags for commit_sha (track 1/8)#39
mastermanas805 merged 1 commit into
masterfrom
obs/obs-4-dockerfile-fresh

Conversation

@mastermanas805
Copy link
Copy Markdown
Member

Summary

Track 1 of 8 in the observability rollout. Wires the api's Docker build to inject instant.dev/common/buildinfo vars at link time so every log line and /healthz response carries the actual commit_id of the running pod (instead of the current "dev" sentinel).

  • Dockerfile: ARG GIT_SHA / BUILD_TIME / VERSION, passed into go build -ldflags -X instant.dev/common/buildinfo.X=....
  • Makefile: docker-build now runs cd .. first (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.
  • cmd/smoke-buildinfo + make smoke-buildinfo target 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.md at 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-existing internal/plans failure (unrelated to this PR; see master commit c4cb536) is green. 15 packages pass, 1 pre-existing failure (free tier rename).
  • make smoke-buildinfo prints smoke-buildinfo: OK (GitSHA=smoke-sha BuildTime=smoke-time Version=smoke-ver).
  • Manual verify: go build -ldflags \"-X instant.dev/common/buildinfo.GitSHA=test123 ...\" -o /tmp/smoke ./cmd/smoke-buildinfo && /tmp/smokeGitSHA=test123 BuildTime=2026-05-12T00:00:00Z Version=v9.9.9.

Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com

…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>
@mastermanas805 mastermanas805 merged commit 6cbb1f6 into master May 12, 2026
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