Stamp main.Version into release binaries via -ldflags#59
Merged
Conversation
Member
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Adds a shared build-arg/workflow-input plumbed through the existing
release pipeline so `oz_worker_info{version=...}` reports the
published release tag (or commit SHA, for ad-hoc builds) instead of
the source default of "dev":
- build_release.yml: new optional `version` workflow input. The build
matrix step now passes `-ldflags="-X main.Version=${VERSION}"` with
precedence `version` input > `docker_tag` input > `github.sha`. The
same value is forwarded to the Docker build via `--build-arg
VERSION=...` so the binary baked into the image carries the same
version string as the standalone release archives.
- create_release.yml: forwards the auto-generated release tag as both
`docker_tag` and `version`, so a release whose tag is
`v2026-04-29-16-30-00` exposes that tag at
`oz_worker_info{version="v2026-04-29-16-30-00"}` and ships in a
Docker image tagged the same way.
- Dockerfile: declares `ARG VERSION=dev` and threads it into the
`go build` invocation. Local `docker build` without `--build-arg`
still produces a "dev" binary, matching the source default.
Verified locally: `go build -ldflags="-X main.Version=test-1.2.3" .`
embeds the value in the binary; running `--help` works and `strings`
confirms the version string is present.
Co-Authored-By: Oz <oz-agent@warp.dev>
6d0954d to
ccda767
Compare
bnavetta
approved these changes
Apr 29, 2026
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.

Adds a shared build-arg/workflow-input plumbed through the existing
release pipeline so
oz_worker_info{version=...}reports thepublished release tag (or commit SHA, for ad-hoc builds) instead of
the source default of "dev":
versionworkflow input. The buildmatrix step now passes
-ldflags="-X main.Version=${VERSION}"withprecedence
versioninput >docker_taginput >github.sha. Thesame value is forwarded to the Docker build via
--build-arg VERSION=...so the binary baked into the image carries the sameversion string as the standalone release archives.
docker_tagandversion, so a release whose tag isv2026-04-29-16-30-00exposes that tag atoz_worker_info{version="v2026-04-29-16-30-00"}and ships in aDocker image tagged the same way.
ARG VERSION=devand threads it into thego buildinvocation. Localdocker buildwithout--build-argstill produces a "dev" binary, matching the source default.
Verified locally:
go build -ldflags="-X main.Version=test-1.2.3" .embeds the value in the binary; running
--helpworks andstringsconfirms the version string is present.
Co-Authored-By: Oz oz-agent@warp.dev