Repository navigation
fix(build): stamp the release version into the images - #332
Andrei Kvapil (kvaps) wants to merge 2 commits into
Conversation
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>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
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>
What broke
The satellite logs
blockstor_versionwhen it starts, but no image build ever setversion.Version, so a released satellite reported0.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.Versionfrom a newVERSIONbuild-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) keeps0.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_versionwith 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 stampsversion.VersionfromVERSION, and the release workflow passesVERSIONto the image build. It fails on main.TestEveryBinaryLogsItsVersionAtStart: the controller, the API server and the satellite each logversion.LogKeywithversion.Versionat start-up. It fails without the change for the controller and the API server.Summary by CodeRabbit