Skip to content

Expose build version via redkey_robin_build_info - #74

Merged
albertompe merged 2 commits into
mainfrom
feature/GH-45-robin-version
Oct 20, 2026
Merged

albertompe merged 2 commits into
mainfrom
feature/GH-45-robin-version

Conversation

@albertompe

@albertompe albertompe commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Make Robin report which build is running.

The image build already passed -ldflags "-X main.version=${VERSION}", but main.version was never declared, so the linker silently ignored it. This PR declares var version = "dev" in cmd/main.go and exposes the version:

  • redkey_robin_build_info gauge (value 1, labels version and go_version), mirroring the operator's redkey_operator_build_info. It is registered on controller-runtime's registry rather than the resettable one, because ResettableRegistry.Reset() would drop it.
  • --version flag: prints the version and exits.
  • The version is included in the startup log.
  • Kubernetes client User-Agent: redkey-robin/<version>.
  • Makefile: make build and make run inject VERSION through LDFLAGS. docker-build and docker-buildx already passed it to the Dockerfile. A plain go build falls back to dev.

The Redis CLIENT SETNAME part of the issue is deferred, because CLIENT SETNAME can fail for ACL-restricted users.

No reconciliation behavior changes.

Closes #45

Additional context

  • New tests:
    • internal/metrics/buildinfo_test.go checks the gauge value and labels.
    • cmd/main_test.go builds the binary with and without -X main.version and checks the --version output. It is skipped under -short.
  • make lint and make test pass.
  • make test-integration
  • Manual check: make build && bin/robin --version prints 0.2.0; go build ./cmd/ prints dev.
  • The dashboard panel and the docs are in the operator PR: InditexTech/redkey-operator#.

Signed-off-by: Alberto Martínez Pérez <albertompe@ext.inditex.com>
@albertompe
albertompe requested a review from a team as a code owner October 20, 2026 10:58
@albertompe
albertompe merged commit 4a9d2d4 into main Oct 20, 2026
18 checks passed
@albertompe
albertompe deleted the feature/GH-45-robin-version branch October 20, 2026 15: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.

[Feature] Wire up the build-time version variable and expose it via build_info

2 participants