8afda7cd8c
CI / Test (store) (pull_request) Successful in 5s
CI / Test (rest) (pull_request) Successful in 9s
CI / Build (windows/amd64) (pull_request) Successful in 7s
CI / Test (server-http) (pull_request) Successful in 17s
CI / Build (linux/amd64) (pull_request) Successful in 7s
CI / Lint (pull_request) Successful in 19s
CI / Build (linux/arm64) (pull_request) Successful in 14s
e2e / Playwright vs docker-compose (pull_request) Successful in 1m27s
The Dockerfile only set `-X main.version=...`, so docker-built binaries
left `internal/version.Version` at its default "dev". The update logic
(host_update.go:61, hosts.go:94, fleet_update.go:101 et al.) compares
against `internal/version.Version`, so a v1.0.0 host always looked
out-of-date to a v1.0.0 server, the chip never cleared, and pressing
"update" re-downloaded the same bundled binary on a loop.
Collapse the two version sources: drop the `var version/commit/date`
locals in cmd/{server,agent}/main.go, route everything through
internal/version (now also carrying Date), and have both the Dockerfile
and the Makefile set the same single set of -X flags. Verified
end-to-end: make build and docker build both emit binaries whose
--version reflects the build VERSION.
21 lines
732 B
Go
21 lines
732 B
Go
// Package version exposes build-time identifying constants. Both the
|
|
// server and agent link this package; their values are set via
|
|
// -ldflags during the build. An unset Version falls back to "dev"
|
|
// so source builds without ldflags still run.
|
|
package version
|
|
|
|
var (
|
|
// Version is the human-facing release string, e.g. "v1.2.3" or
|
|
// "v1.2.3-dirty". Compared byte-for-byte between agent and
|
|
// server to drive the "out of date" signal.
|
|
Version = "dev"
|
|
|
|
// Commit is the short git SHA. Informational only; surfaced via
|
|
// /api/version but not used for any comparison.
|
|
Commit = ""
|
|
|
|
// Date is the RFC3339 build timestamp. Informational only; printed
|
|
// by `--version` but not used for any comparison.
|
|
Date = "unknown"
|
|
)
|