v0.5.2 replaced the hardcoded, drifting "version", "0.1.0" startup log with a -ldflags-overridable var version = "dev". That stops the lie, but the deployed image still logs version=dev because nothing injects the actual tag/sha at build time.
Fix (small)
Wire the version through the existing CD metadata:
.gitea/workflows/cd.yml build step: pass --build-arg VERSION=${{ steps.meta.outputs.version-tag || steps.meta.outputs.sha-tag }} to the buildah build invocation (the meta step already computes both a version-tag on v* and a short-sha tag).
Then the running pod's startup log (and any future /version) reports the real build.
Acceptance
A tagged build logs version=<tag>; an untagged main build logs the short sha.
Local go build still works (defaults to dev).
CD build passes.
Refs
Follow-up to v0.5.2 housekeeping. cmd/gitea-mcp/main.goversion var; .gitea/workflows/cd.ymlmeta step already has the tags.
## Context
v0.5.2 replaced the hardcoded, drifting `"version", "0.1.0"` startup log with a `-ldflags`-overridable `var version = "dev"`. That stops the lie, but the deployed image still logs `version=dev` because nothing injects the actual tag/sha at build time.
## Fix (small)
Wire the version through the existing CD metadata:
- **Dockerfile**: `ARG VERSION=dev` + `go build -ldflags "-s -w -X main.version=${VERSION}" ...`
- **`.gitea/workflows/cd.yml`** build step: pass `--build-arg VERSION=${{ steps.meta.outputs.version-tag || steps.meta.outputs.sha-tag }}` to the `buildah build` invocation (the `meta` step already computes both a version-tag on `v*` and a short-sha tag).
Then the running pod's startup log (and any future `/version`) reports the real build.
## Acceptance
- [ ] A tagged build logs `version=<tag>`; an untagged main build logs the short sha.
- [ ] Local `go build` still works (defaults to `dev`).
- [ ] CD build passes.
## Refs
- Follow-up to v0.5.2 housekeeping. `cmd/gitea-mcp/main.go` `version` var; `.gitea/workflows/cd.yml` `meta` step already has the tags.
Dockerfile: ARG VERSION=dev + go build -ldflags="-s -w -X main.version=${VERSION}".
cd.yml build step: --build-arg VERSION=<version-tag on v* builds, else short sha> (the meta step already computes both).
Verified locally that -ldflags -X main.version=… embeds the string into the binary. On a main-branch push the deployed image is the sha-tagged build, so the pod now logs version=<short-sha> instead of dev; a v* tag build logs the tag. Local go build still defaults to dev. task check green (exit 0). Verifying the live pod log after the CD roll.
Done in v0.6.1.
- **Dockerfile**: `ARG VERSION=dev` + `go build -ldflags="-s -w -X main.version=${VERSION}"`.
- **cd.yml** build step: `--build-arg VERSION=<version-tag on v* builds, else short sha>` (the `meta` step already computes both).
Verified locally that `-ldflags -X main.version=…` embeds the string into the binary. On a main-branch push the deployed image is the sha-tagged build, so the pod now logs `version=<short-sha>` instead of `dev`; a `v*` tag build logs the tag. Local `go build` still defaults to `dev`. `task check` green (exit 0). Verifying the live pod log after the CD roll.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Context
v0.5.2 replaced the hardcoded, drifting
"version", "0.1.0"startup log with a-ldflags-overridablevar version = "dev". That stops the lie, but the deployed image still logsversion=devbecause nothing injects the actual tag/sha at build time.Fix (small)
Wire the version through the existing CD metadata:
ARG VERSION=dev+go build -ldflags "-s -w -X main.version=${VERSION}" ....gitea/workflows/cd.ymlbuild step: pass--build-arg VERSION=${{ steps.meta.outputs.version-tag || steps.meta.outputs.sha-tag }}to thebuildah buildinvocation (themetastep already computes both a version-tag onv*and a short-sha tag).Then the running pod's startup log (and any future
/version) reports the real build.Acceptance
version=<tag>; an untagged main build logs the short sha.go buildstill works (defaults todev).Refs
cmd/gitea-mcp/main.goversionvar;.gitea/workflows/cd.ymlmetastep already has the tags.Done in v0.6.1.
ARG VERSION=dev+go build -ldflags="-s -w -X main.version=${VERSION}".--build-arg VERSION=<version-tag on v* builds, else short sha>(themetastep already computes both).Verified locally that
-ldflags -X main.version=…embeds the string into the binary. On a main-branch push the deployed image is the sha-tagged build, so the pod now logsversion=<short-sha>instead ofdev; av*tag build logs the tag. Localgo buildstill defaults todev.task checkgreen (exit 0). Verifying the live pod log after the CD roll.