Skip to content

Make kcvm reliable - #1

Merged
raqqun merged 3 commits into
masterfrom
reliability-fixes
Oct 11, 2026
Merged

raqqun merged 3 commits into
masterfrom
reliability-fixes

Conversation

@raqqun

@raqqun raqqun commented Oct 11, 2026 •

Copy link
Copy Markdown
Owner

Summary

Fixes the bugs and fragile spots in kcvm's commands. The CI workflow is unchanged.

Bug fixes

  • install downloads into ~/.kcvm/bin and renames the file into place once complete. This fixes cross-device rename failures when /tmp is a separate filesystem, and failed downloads no longer leave files behind.
  • install / use replace the kubectl symlink in a single atomic step. This also fixes switching away from a version whose binary was deleted, which used to fail with "file exists".
  • list local skips unexpected files in bin/ instead of crashing.
  • --dir is made absolute, so a relative path no longer creates a symlink that only works from one directory.

Reliability

  • list remote fetches tags with a single git ls-refs request, the same one git ls-remote --tags makes, instead of 13 paginated GitHub API calls. That avoids the 60 requests/hour unauthenticated limit. Errors are reported instead of producing a partial list, and versions are sorted newest first.
  • install checks downloads against the published SHA-256. Releases before v1.16 publish none, so for those it warns and skips the check.
  • Requests retry and time out instead of hanging.
  • Version arguments are checked, and 1.20.0 is accepted as v1.20.0.
  • Error messages say what to do next.

Other

  • install creates ~/.kcvm/bin when missing. Already-installed versions are skipped unless --force is given.
  • init warns when ~/.kcvm isn't on $PATH.
  • go.mod requires Go 1.16 instead of 1.14.
  • The README covers the new behavior, a go install option and a working download link.

Behavior changes

  • list local marks the active version with * and indents the others by two spaces.
  • list remote lists newest first.
  • Installing an already-installed version just switches to it; --force downloads it again.

Testing

  • go test ./test/kcvm/ runs 17 tests against local fake servers, with no network needed.
  • Ran manually against the real servers: list remote (575 stable versions), installing v1.31.0 and v1.30.2 with checksum checks, use, list local, and installing a version that doesn't exist.

Versioning and CI

  • The new VERSION file holds the version, now v0.3.0; bump it for every new version. The binary reads it at build time, so kcvm --version is correct for go install builds too, and a test checks the file contains a valid version.
  • The Build workflow is disabled: it can only be started by hand. Every run published the hardcoded v0.2.2-beta1 release, including on pull requests. When run by hand, it now takes the release tag from VERSION.

- install: download next to the final binary and rename into place, which
  fixes cross-device rename failures when /tmp is a separate filesystem and
  never leaves partial downloads behind
- install: verify the published sha256 checksum, create ~/.kcvm/bin when
  missing, skip already installed versions unless --force is given
- install/use: switch the kubectl symlink atomically, which also fixes
  switching away from a version whose binary was deleted
- validate and normalize version arguments (1.20.0 -> v1.20.0)
- list remote: list tags with a single git ls-refs request instead of a
  dozen rate limited GitHub API calls, report errors, sort by version
- list local: skip unexpected files instead of panicking, mark the active
  version, explain how to initialize kcvm when needed
- resolve --dir to an absolute path so the symlink stays valid
- tests run against local fake servers instead of the real network
Every run publishes a release with the hardcoded release-tag. Only allow
manual runs until releases are reworked.
Set the version to v0.3.0. The binary embeds the file, so kcvm --version is
correct for go install builds too, and the release workflow tags releases
with it instead of a hardcoded release-tag.
@raqqun raqqun self-assigned this Oct 11, 2026
@raqqun
raqqun merged commit 4bf8a14 into master Oct 11, 2026
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.

1 participant