From 94adedc2d76e8b9577419b072f22f817e63407de Mon Sep 17 00:00:00 2001 From: Sam Catlow Date: Mon, 10 Aug 2026 02:42:24 +1000 Subject: [PATCH] fix(build): stamp versions in task build, not only in the Docker image Version stamping lived solely in Dockerfile.archied's -ldflags, so any build from source reported gatewayVersion/runtimeVersion as "dev". That covers every host deployment: carina builds the binaries with go build and runs them under systemd, never touching the image, so /version there answered "Archie Gateway: dev Runtime: dev" for a tagged release. Derive the same -X values from the release tags. git describe without --abbrev=0 gives 1.7.0-2-gbb54786 when HEAD has moved past the tag, which is the honest answer for a mid-cycle build rather than claiming the release itself. archie-agent has no version variable, so only archied is stamped. --- Taskfile.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Taskfile.yml b/Taskfile.yml index bbadfecbf..83728a78e 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -86,6 +86,17 @@ tasks: build: desc: Build archied and archie-agent binaries + # Version stamping used to live only in Dockerfile.archied, so any build + # from source -- including a host deployment -- reported "dev" for + # both components and /version was useless there. Derive the same + # -X values from the release tags so a source build is stamped too. + # git describe (without --abbrev=0) yields 1.7.0-2-gbb54786 when HEAD is + # past the tag, which is the honest answer for a mid-cycle build. + vars: + GATEWAY_VERSION: + sh: git describe --tags --match 'archied/v*' 2>/dev/null | sed 's|^archied/v||' || echo dev + RUNTIME_VERSION: + sh: git describe --tags --match 'archie/v*' 2>/dev/null | sed 's|^archie/v||' || echo dev sources: - "**/*.go" - go.mod @@ -94,7 +105,7 @@ tasks: - "{{.BIN_DIR}}/archied" - "{{.BIN_DIR}}/archie-agent" cmds: - - go build -o {{.BIN_DIR}}/archied ./cmd/archied + - go build -ldflags "-X main.gatewayVersion={{.GATEWAY_VERSION}} -X main.runtimeVersion={{.RUNTIME_VERSION}}" -o {{.BIN_DIR}}/archied ./cmd/archied - go build -o {{.BIN_DIR}}/archie-agent ./cmd/archie-agent test: