Skip to content

feat(build): binaries report their own build ID as their version; --version on every component (#1378, #1429) - #1465

Merged
bpalermo merged 2 commits into
mainfrom
upgrade/1378-binary-build-id
Oct 8, 2026
Merged

bpalermo merged 2 commits into
mainfrom
upgrade/1378-binary-build-id

Conversation

@bpalermo

@bpalermo bpalermo commented Oct 8, 2026 •

Copy link
Copy Markdown
Owner

Bottom of a three-PR stack for #1378 (every merge to main gives every image a new digest, so every deploy rolls every workload). This one removes the first of the two causes; the next removes the second; the third adds the CI check.

Part of #1378
Closes #1429

What

Seven binaries (agent, mesh-dns, proxy-supervisor, uds-csi, controller, prober, registrar) linked the commit in as Version, through x_defs with {STABLE_GIT_VERSION}. Under --stamp each of them, and the image layer built from it, changed with every commit, including a docs-only one.

  • Version is now the binary's own GNU build ID: the content-derived note //bazel/buildid already writes into every shipped binary, read from the running executable by a new stdlib-only package, //common/buildinfo. The seven x_defs are gone.
  • The same seven components answer --version (observability: no component has a --version flag #1429): build ID, main package, Go toolchain. They exit before starting anything. The stdlib-only probe binaries and the CNI plugin stay flagless.
  • charts/README.md no longer says the chart's appVersion matches a version embedded in the binaries; the runbook gets "Which build is this binary".

What reads Version, and what an operator loses

Read in the code, every use:

Reader Before After
OTel service.version (all seven) git describe of the commit the binary's build ID, 40 hex characters
uds-csi CSI vendor_version and its starting log line the same the build ID

Nothing else reads it. No dashboard or alert in this repository refers to service.version.

What is lost: service.version no longer names a commit, so telemetry alone does not say which commit a pod runs. What replaces it:

  • Two pods with the same service.version run byte-identical binaries; a value that changes across a deploy means that component's code changed.
  • Commit to image: the dev-<sha> tag and the per-commit chart, which pins every image by digest.
  • Image to commit: the signature's certificate and the provenance attestation of the digest (docs/verifying-releases.md, updated in the next PR).
  • Build ID to source: make check-build-id at a candidate commit.

Evidence

Measured on a developer machine, real workspace status, --stamp:

  • --version on the shipped binaries prints the ID readelf -n prints, for mesh-dns, proxy-supervisor, uds-csi and prober (four different IDs). A binary outside an image prints the constant ID rules_go links into every binary (498919af…); the runbook says so.
  • Two commits that differ only in README.md, this PR alone: 10 of 10 image digests still change (the image metadata still carries the commit). With the next PR on top: 0 of 10. On main: 10 of 10.
  • At the tip of the stack, 272 tests pass: the touched packages, every image test, every deps_test and size ceiling (mesh-dns, proxy-supervisor, uds-csi, cni, the four probe binaries), the chart tests and //bazel/buildid. The Go tests touched also pass under --config=race.
  • make format-check and the lint build with fail_on_violation over the touched packages are clean; gazelle makes no change.

Not verified

  • The commit message's size figures for parsing the note by hand instead of with debug/elf (37 KB against 167 KB on the proxy supervisor) come from the earlier work on this branch; I did not re-measure them. The size ceilings pass either way.
  • Dashboards outside this repository that group or filter by service.version.
  • arm64: the parser is tested on synthetic little- and big-endian images and on the amd64 test binary; no arm64 binary was run.

Merge order

This PR is safe to merge on its own at any time: it changes no digest behaviour by itself (10 of 10 still change). The order question belongs to the next PR and is answered there.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

Copilot AI balanced review requested due to automatic review settings October 8, 2026 20:11
@bpalermo
bpalermo added this pull request to stack #1468 October 8, 2026 20:11
@bpalermo bpalermo changed the title upgrade/1378 binary build id feat(build): binaries report their own build ID as their version; --version on every component (#1378, #1429) Oct 8, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The build-ID parser is bounded and comprehensively tested, while each affected component has coverage for early version exit and telemetry-version consistency.

0 open findings

What changed in this PR

Replaces commit-stamped component versions with content-derived GNU build IDs and adds --version support across seven shipped binaries.

Changes:

  • Adds a stdlib-only ELF build-ID reader and version formatter.
  • Removes STABLE_GIT_VERSION linkage and exposes build metadata through component CLIs.
  • Adds tests and operator documentation for the new version semantics.
File Description
common/​buildinfo/​buildinfo.go Implements build-ID parsing and version output.
common/​buildinfo/​buildinfo_test.go Tests ELF parsing and formatting.
common/​buildinfo/​BUILD.bazel Defines the new package and tests.
agent/​internal/​cmd/​root.go Uses build ID and adds agent version output.
agent/​internal/​cmd/​version_test.go Tests agent version behavior.
agent/​internal/​cmd/​BUILD.bazel Adds buildinfo dependencies and test.
agent/​cmd/​agent/​BUILD.bazel Removes commit-based version stamping.
agent/​cmd/​mesh-dns/​main.go Adds mesh-dns build-ID version output.
agent/​cmd/​mesh-dns/​version_test.go Tests mesh-dns version behavior.
agent/​cmd/​mesh-dns/​BUILD.bazel Updates dependencies, tests, and stamping.
agent/​cmd/​proxy-supervisor/​main.go Sources supervisor version from its build ID.
agent/​cmd/​proxy-supervisor/​BUILD.bazel Removes stamping and adds buildinfo.
agent/​internal/​supervisorcmd/​supervisor.go Adds supervisor --version handling.
agent/​internal/​supervisorcmd/​version_test.go Tests supervisor version behavior.
agent/​internal/​supervisorcmd/​BUILD.bazel Registers buildinfo and version tests.
agent/​cmd/​uds-csi/​main.go Adds build-ID version reporting.
agent/​cmd/​uds-csi/​version_test.go Tests CSI version handling.
agent/​cmd/​uds-csi/​BUILD.bazel Updates dependencies, tests, and stamping.
controller/​internal/​cmd/​root.go Uses build ID and adds version output.
controller/​internal/​cmd/​version_test.go Tests controller version behavior.
controller/​internal/​cmd/​BUILD.bazel Adds buildinfo dependencies and test.
controller/​cmd/​controller/​BUILD.bazel Removes commit-based version stamping.
prober/​internal/​cmd/​root.go Uses build ID and adds version output.
prober/​internal/​cmd/​root_test.go Tests prober version behavior.
prober/​internal/​cmd/​BUILD.bazel Adds command tests and buildinfo dependency.
prober/​cmd/​prober/​BUILD.bazel Removes commit-based version stamping.
registrar/​internal/​cmd/​root.go Uses build ID and adds version output.
registrar/​internal/​cmd/​version_test.go Tests registrar version behavior.
registrar/​internal/​cmd/​BUILD.bazel Adds buildinfo dependencies and test.
registrar/​cmd/​registrar/​BUILD.bazel Removes commit-based version stamping.
bazel/​buildid/​buildid.go Documents the build ID’s expanded role.
bazel/​buildid/​defs.bzl Updates build-ID rule documentation.
Makefile Clarifies remaining stamped metadata.
charts/​README.md Distinguishes chart and binary versions.
docs/​runbook.md Documents querying and tracing binary builds.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Copilot AI balanced review requested due to automatic review settings October 8, 2026 20:59
@bpalermo
bpalermo force-pushed the upgrade/1378-binary-build-id branch from ebbd73a to 04b4f60 Compare October 8, 2026 20:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The documented every-component scope omits cni-install, and build-ID lookup does not account for the published binary architecture.

2 open findings

🧠 Review effort: Balanced

Comment thread docs/runbook.md Resolved
Comment thread docs/runbook.md Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The implementation is consistent across components and includes focused parser, command, and architecture-aware coverage.

0 open findings

2 resolved since last review

🧠 Review effort: Balanced

bpalermo and others added 2 commits October 8, 2026 19:50
…ersion on every component (#1378, #1429)

Seven binaries linked the commit in as `Version` (`x_defs` with
`{STABLE_GIT_VERSION}`), so under `--stamp` each of them, and every image layer
built from them, changed with every commit, including a docs-only one.

`Version` is now the binary's own GNU build ID, the content-derived note
`//bazel/buildid` writes, read from the running executable by the new
stdlib-only `//common/buildinfo`. The `x_defs` are gone from agent, mesh-dns,
proxy-supervisor, uds-csi, controller, prober and registrar. The value still
flows to the same places: OTel `service.version` and the CSI plugin's
`vendor_version`.

Those seven components also answer `--version` (#1429): build ID, main package
and Go toolchain. The stdlib-only probe binaries and the CNI plugin stay
flagless.

The note is parsed by hand, not with `debug/elf`: measured on the proxy
supervisor, `debug/elf` adds 167 KB and the hand parser 37 KB over main. It
reads note sections first and note segments second, because Go's own linker
leaves `.note.gnu.build-id` out of the PT_NOTE segment in a static binary.

Under `--stamp`, at two commits that differ in one file nothing depends on, the
seven binaries are now byte-identical (they all differed before). Image digests
still differ until the image metadata stops carrying the commit, which is the
next change in this stack.

Part of #1378
Closes #1429

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
…ints both architectures (#1378, #1429)

Review of the build-ID change:

- `cni-install` has a cobra command line and was left without `--version`,
  while the runbook said every component with a command line has it. It now
  answers like the other seven. The runbook lists the eight binaries that do
  and the five that do not (the four probe binaries and the CNI plugin), with
  the reason for each.
- A build ID belongs to one architecture's binary, and `make check-build-id`
  built only the host's. It now builds
  `--platforms=@rules_go//go/toolchain:linux_<arch>` for amd64 and arm64 and
  prints both lists. Checked against an image: the mesh-dns binary extracted
  from the arm64 layer of the built index reads `e24fbf71…` with `readelf -n`
  (machine AArch64), the ID the arm64 list prints; the amd64 layer reads
  `f40e658d…`, the ID the amd64 list prints.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
@bpalermo
bpalermo force-pushed the upgrade/1378-binary-build-id branch from e94cc5d to 1400f8a Compare October 8, 2026 22:50
Copilot AI balanced review requested due to automatic review settings October 8, 2026 22:50

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The build-ID parser, CLI behavior, architecture handling, and affected build definitions are consistently implemented and well tested.

0 open findings

🧠 Review effort: Balanced

@bpalermo
bpalermo merged commit b160201 into main Oct 8, 2026
31 checks passed
@bpalermo
bpalermo deleted the upgrade/1378-binary-build-id branch October 8, 2026 23:08
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.

observability: no component has a --version flag

2 participants