Skip to content

feat(docker): inject version metadata via ldflags#245

Merged
fernando-villalba merged 1 commit intomainfrom
feat/inject-build-version-metadata
Feb 17, 2026
Merged

feat(docker): inject version metadata via ldflags#245
fernando-villalba merged 1 commit intomainfrom
feat/inject-build-version-metadata

Conversation

@fernando-villalba
Copy link
Collaborator

The operator binary always reported version=dev, buildDate=unknown, and gitCommit=unknown because no ldflags were passed during the Docker build. This made it impossible to identify which commit a running operator was built from, both in logs and OTEL traces.

  • Add VERSION, GIT_COMMIT, BUILD_DATE ARGs to Dockerfile with safe defaults (dev/unknown) for plain docker build
  • Wire -X main.version, -X main.gitCommit, -X main.buildDate into go build ldflags
  • Update Makefile container and docker-buildx targets to pass git rev-parse --short HEAD, git rev-parse HEAD, and date
  • Add Compute short SHA step in build-and-release.yaml to pass the 7-char SHA as VERSION via GITHUB_ENV

The operator now logs its exact commit and build timestamp at startup, and OTEL traces carry the short SHA as service version.

The operator binary always reported version=dev, buildDate=unknown,
and gitCommit=unknown because no ldflags were passed during the
Docker build. This made it impossible to identify which commit a
running operator was built from, both in logs and OTEL traces.

- Add VERSION, GIT_COMMIT, BUILD_DATE ARGs to Dockerfile with
  safe defaults (dev/unknown) for plain docker build
- Wire -X main.version, -X main.gitCommit, -X main.buildDate
  into go build ldflags
- Update Makefile container and docker-buildx targets to pass
  git rev-parse --short HEAD, git rev-parse HEAD, and date
- Add Compute short SHA step in build-and-release.yaml to pass
  the 7-char SHA as VERSION via GITHUB_ENV

The operator now logs its exact commit and build timestamp at
startup, and OTEL traces carry the short SHA as service version.
@github-actions
Copy link

🔬 Go Test Coverage Report

Summary

Coverage Type Result
Threshold 0%
Previous Test Coverage 0.0%
New Test Coverage 0.0%

Status

✅ PASS

Detail

Show New Coverage
total:	(statements)	0.0%

@fernando-villalba fernando-villalba merged commit ab56cc6 into main Feb 17, 2026
4 checks passed
@fernando-villalba fernando-villalba deleted the feat/inject-build-version-metadata branch February 17, 2026 15:06
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

Comments