Skip to content

fix(build): stamp the release version into the images - #332

Open
Andrei Kvapil (kvaps) wants to merge 2 commits into
mainfrom
fix/satellite-version-stamp
Open

Andrei Kvapil (kvaps) wants to merge 2 commits into
mainfrom
fix/satellite-version-stamp

Conversation

@kvaps

@kvaps Andrei Kvapil (kvaps) commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

What broke

The satellite logs blockstor_version when it starts, but no image build ever set version.Version, so a released satellite reported 0.0.0-dev. Its logs could not tell which release a node was running, while the CLI built from the same tag printed the tag.

Fix

The Dockerfile stamps version.Version from a new VERSION build-arg, next to the git hash and build time it already stamps. The release workflow passes it the same way the cli job sets the CLI version: the tag on a tag build, dev-<sha> on a dry run. A build without the arg (the dev stand, make docker-build) keeps 0.0.0-dev.

The controller and the API server logged no version at all, although the Dockerfile says every binary does. Both now log blockstor_version with their start-up line, under the key the satellite uses (version.LogKey), so a controller upgraded ahead of its satellites can be read from the logs alone.

Testing

  • tests/manifests/version_stamp_test.go: every ldflags set in the Dockerfile stamps version.Version from VERSION, and the release workflow passes VERSION to the image build. It fails on main.
  • TestEveryBinaryLogsItsVersionAtStart: the controller, the API server and the satellite each log version.LogKey with version.Version at start-up. It fails without the change for the controller and the API server.
  • The release workflow itself only runs on a tag or a manual dispatch, so the stamped value is checked on the next release.

Summary by CodeRabbit

  • New Features
    • Container images now include version information, using the release tag or a development identifier.
    • Startup logs for the API server, controller, and satellite now display the application version.

The satellite logs version.Version when it starts, but no image build
ever set it, so a released satellite reported 0.0.0-dev and its logs
could not tell which release a node was running, while the CLI built
from the same tag printed the tag. Stamp it from a VERSION build-arg
that the release workflow fills the way the cli job does; a dev build
keeps 0.0.0-dev.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The release workflow now passes a version value to image builds, and the Dockerfile stamps it into binaries. The API server, controller, and satellite include the version key and value in startup logs.

Changes: Binary version reporting

Layer / File(s) Summary
Pass and stamp image versions
.github/workflows/release.yml, Dockerfile, tests/manifests/version_stamp_test.go
The release workflow passes the tag name for tag runs or dev- plus the commit SHA otherwise. The Dockerfile stamps VERSION through linker flags. Manifest tests check the build argument and linker flags.
Add version fields to startup logs
pkg/version/version.go, cmd/apiserver/main.go, cmd/controller/main.go, pkg/satellite/agent.go, tests/manifests/version_stamp_test.go
The API server and controller add the version key and value to startup logs. The satellite uses the shared version.LogKey constant. Manifest tests check the logging expressions.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: Minimal · up to e3f11

This change stamps the release version into container images and adds the version to startup logs for the API server, controller, and satellite. No concrete merge-blocking risk was found. Builds without the argument keep the 0.0.0-dev default, and the first real release will confirm the stamped value.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(build): stamp the release version into the images" matches the main change. The Dockerfile gains a VERSION build argument, the release workflow passes it, and the linker flags stamp pkg…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check

Explanation

The title "fix(build): stamp the release version into the images" matches the main change. The Dockerfile gains a VERSION build argument, the release workflow passes it, and the linker flags stamp pkg/version.Version. The title is specific and uses a conventional commit prefix. It does not mention the later logging changes, which is acceptable because the title need not cover every detail.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f4d8073a-f79e-4bef-8006-5039e3374d1f
Commits

Reviewing files that changed from the base of the PR and between d1b8e1d and e3f11bb.

Files selected for processing: 7

  • .github/workflows/release.yml
  • Dockerfile
  • cmd/apiserver/main.go
  • cmd/controller/main.go
  • pkg/satellite/agent.go
  • pkg/version/version.go
  • tests/manifests/version_stamp_test.go

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

The Dockerfile says every binary logs the release it was built for at
start-up, but only the satellite did. The controller and the API
server logged none, so a controller upgraded ahead of its satellites
looked the same in its logs as one that was not, and the version was
only to be had from the REST API.

Both now log it with their start-up line, under the key the
satellite uses, which the version package now names once.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>

This branch has not been deployed

No deployments
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