Fix datumctl version crashing on unparseable client/server versions - #279
Open
smerwin wants to merge 1 commit into
Open
Fix datumctl version crashing on unparseable client/server versions#279smerwin wants to merge 1 commit into
smerwin wants to merge 1 commit into
Conversation
|
|
kubectl's version command treats a failure to parse either the client or server GitVersion as semver during its skew check as fatal, even though both versions were already printed. This surfaces as a hard crash when a server (or a locally built client) reports a version string containing an unresolved `git archive` export-subst placeholder like `v0.0.0-master+$Format:%H$`, which isn't valid semver. Override the version command's RunE to drive kubectl's own exported Options type directly, and downgrade that specific parse failure to a warning instead of a fatal error, while still surfacing real connectivity/discovery errors normally. Fixes datum-cloud#264 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
smerwin
force-pushed
the
fix/version-skew-parse-error
branch
from
September 10, 2026 03:08
3cdb906 to
579904c
Compare
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.
Summary
datumctl versiondelegates to kubectl'sversioncommand, which after printing the client/server versions runs a skew check that strictly parses bothGitVersionstrings as semver.git archiveexport-subst placeholder likev0.0.0-master+$Format:%H$, that parse fails and kubectl treats it as fatal — the process exits non-zero even though both versions were already printed.k8s.io/kubectl/pkg/cmd/versionpackage, this overridesversionCmd'sRunEto drive kubectl's own exportedversion.Optionstype directly (same pattern already used inWrapGetCommandforkubectl get). The parse failure is detected via the two stable error prefixes kubectl's skew-check uses ("client version error:"/"server version error:") and downgraded to aWarning:on stderr instead of a fatal error. Real connectivity/discovery errors still propagate normally.Fixes #264
Test plan
go build ./...go test ./internal/cmd/...(newTestIsVersionSkewParseErrorpasses)datumctl version --client(plain,-o json,-o yaml) still works... version error: could not parse pre-release/metadata ...error; after the fix, the same input now returns success (exit 0) with a warning on stderr instead of crashing🤖 Generated with Claude Code