Skip to content

fix: Report unreleased builds as pseudo-versions - #362

Merged
drewr merged 1 commit into
mainfrom
fix/pseudo-version
Nov 9, 2026
Merged

drewr merged 1 commit into
mainfrom
fix/pseudo-version

Conversation

@drewr

@drewr drewr commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Builds from main reported their version as v0.0.0 plus a commit, or as the last release plus a commit, which semver treats as equal to that release.

Every build path now reports the pseudo-version Go already stamps into the binary. It names the commit and sorts after the last release and before the next one, so the update checker and plugin checks see it correctly.

The version command also stops running kubectl's client/server skew check, which compared unrelated versions and crashed on non-semver server versions.

Client Version: v0.23.4-0.20261106200105-557cf6782621+dev
Kustomize Version: v5.8.1
Server Version: v1.37.1-milo.0.36.25+d4201164beb0c3c14931a72889970f6f49267857

Test plan

  • Go, Task, and Nix builds of one commit report the same pseudo-version, and a tagged commit reports the tag
  • A dirty tree appends +dev in every build path, and a clean Nix build no longer does
  • The version command exits 0 against a Milo server
  • Unit tests pass

Fixes #264
Supersedes #279

Builds from main reported v0.0.0+<sha> (plain go build, or nix
without a VERSION file) or <last-tag>+<sha> (task build). The first
hides the release the build came from. The second compares equal to
that release, because semver ignores build metadata, so neither the
update checker nor a reader can tell it apart from the real thing.

The Go toolchain already stamps a pseudo-version into every build,
such as v0.23.4-0.20261106200105-557cf6782621. It names the commit,
and sorts after the last release and before the next one. datumctl
now uses that version everywhere it reads its own: the update
checker, auto-update, plugin compatibility, and `datumctl version`.

component-base can't hold it, since SetDynamicVersion only accepts
0.0.0 versions, so `datumctl version` no longer delegates to
kubectl's Run. Doing so also drops kubectl's client/server skew
check. datumctl's version and the Datum Cloud API server's are
unrelated, and the check failed outright on non-semver server
versions.

The JSON and YAML output now fills gitCommit, gitTreeState,
buildDate (the commit time, as reproducible builds use) and
major/minor from the build's VCS info when ldflags left them at
their placeholders.

Nix and task builds produce the same string:
- task build drops its gitVersion ldflag and lets Go stamp it
- task nix-build writes `git describe --tags --long --dirty` to
  VERSION, and the flake builds the pseudo-version from it. Staging
  VERSION made nix see every tree as dirty, so the flake takes
  dirtiness from the describe output instead.
- A dirty tree appends +dev.

Fixes #264

Co-Authored-By: Claude <claude@anthropic.com>
@drewr
drewr force-pushed the fix/pseudo-version branch from 3ab15a4 to 187997d Compare November 9, 2026 23:14
@drewr drewr changed the title fix: Base unreleased build versions on the last release fix: Report unreleased builds as pseudo-versions Nov 9, 2026
@drewr
drewr marked this pull request as ready for review November 9, 2026 23:17
@drewr
drewr requested a review from a team as a code owner November 9, 2026 23:17
@drewr
drewr enabled auto-merge November 9, 2026 23:19
@drewr
drewr requested a review from scotwells November 9, 2026 23:20
@drewr drewr self-assigned this Nov 9, 2026

@ecv ecv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve. goreleaser's ldflags still take precedence, so release builds report the exact tag. A main build's pseudo-version sorts after the last release and before the next one, so the update checker never offers it a downgrade. The removed skew check had no other caller.

Follow-ups:

  • Nothing tests runVersion, which is the path that crashed against Milo. Neither the pseudo-version logic in flake.nix nor the Taskfile one has a test or a CI check.
  • A plugin whose minDatumctlVersion names the next, unreleased version will not run on main builds, as before. Document it for plugin authors.

@drewr
drewr merged commit 7ce18a5 into main Nov 9, 2026
2 checks passed
@drewr
drewr deleted the fix/pseudo-version branch November 9, 2026 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

datumctl version: fails to parse server version, breaks on unresolved git archive placeholder

2 participants