Repository navigation
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Why
There is no way to tell which build a worker host is running. The CLI has no
versioncommand,make releasebuilds with-ldflags="-s -w"only, and the Docker image stamps nothing. An operator asking for help, or anyone checking that hosts are on the current release, has to guess from install dates.This is also the first step toward deliverable D6 in the compute grants proposal (draft v4.1, section 3.3, item 4), which makes "a worker version string" a condition for paid slots and notes that no current build sends one today. This PR gives the binary a version to report; sending it in the heartbeat is the follow-up described below.
Proposal: https://github.com/lightchain-protocol/lightchain-dao-proposals/tree/main/proposals/2026-10-compute-grants
What
internal/buildinfo:Version(set with-X, defaultdev), plus the commit and dirty flag the Go toolchain records, the Go version and the platform.lightchain-worker version(and--version) prints one line, for examplelightchain-worker v1.2.3 (commit 1a2b3c4d5e6f, go1.26.0, linux/amd64). Added to the usage text.journalctland container logs.Makefile:VERSIONis the tag on a CI tag build (GITHUB_REF_TYPE/GITHUB_REF_NAME), otherwisegit describe --tags --always --dirty, otherwisedev. It can be overridden withmake release VERSION=….Dockerfile:ARG VERSION=devpassed to both builds. CI passessteps.meta.outputs.version, so the image reports the tag, branch or commit it is published as.Not in this PR
The heartbeat payloads are unchanged. The gateway that reads them is not in this repository, so I didn't want to add a field it might reject. If the gateway accepts an extra field, I can follow up with a
workerVersionfield in the heartbeat.Testing
go test ./internal/buildinfo/covers four cases: a release with a commit, a dirty local build, no VCS data (as in the image), and build info being unavailable.go test ./...with the shared package (testnet): all passmake release VERSION=v0.0.0-testthen./dist/lightchain-worker-linux-amd64 versionprintslightchain-worker v0.0.0-test (commit d371cd2f7f3b-dirty, go1.27.1, linux/amd64)docker build --build-arg VERSION=v0.0.0-test -f worker/Dockerfile .thendocker run --rm --entrypoint /bin/lightchain-worker <image> version. CI builds the image on this PR.The patch applies cleanly on
mainand on top of #31.