feat(version): replace --version with version subcommand; add check/update/--train (MK-26) #45
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/version-subcommand-update-train-MK-26"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Resolves MK-26.
Replaces the bare
--versionclap flag with aversionsubcommand tree and adds a--trainrelease-channel selector, mirroring the youtrack-cli + forgejo-cli ergonomics.What changed
monkey version/monkey version showprint the build banner (same content the old--versionproduced). The bare--versionflag is removed and now errors.monkey version check [--train <name>]HEADs the channel sha256 sidecar, comparesLast-Modifiedagainst the bakedMONKEY_BUILD_DATE, and reports behind / current / unknown. A 404 produces anavailable trains:message rather than a raw HTTP error.monkey version update [--train <name>] [--force] [--dry-run] [--url <base>]resolves the running binary, refuses inside an OCI container with adocker pullpointer, pre-checks the parent directory is writable before downloading, then downloads, SHA256-verifies, atomically renames over the running binary, smoke-tests<new> version, and prints FROM/TO lines.src/version.rsmodule: action enum, URL/train resolution, container detection (Docker / containerd / podman via/.dockerenv+/proc/1/cgroup), writable pre-flight, sha256 verify, and the freshness decision.time; hashing usessha2.httpmockis a dev-dependency only (not in the binary).build.rsbakesMONKEY_UPDATE_URL(env-overridable, defaults to the public Forgejo Generic Package base)..forgejo/workflows/build-binary.ymlwrites a<asset>.sha256sidecar next to each published binary, publishes binary + sidecar together, and on release tags also publishes to thestablechannel thatversion updatedefaults to.lateststays an alias forstableuntil beta / nightly channels exist.monkey version updateunder the Static binary section.Release-channel notes
stableis the default train.beta/nightly/latestare accepted and resolve to thestableregistry path in this MVP (placeholders until the workflow grows channel-aware publishing). Unknown train names fall through and surface theavailable trains:message on a 404.Tests
cargo test): container-detection matcher, per-train URL builder, sha256 mismatch rejection, dry-run / up-to-date decision, writable pre-flight, HTTP-date parsing.#[ignore]d httpmock integration test (tests/version_update.rs) drives the full download / verify / atomic-replace / smoke-test path and the sha256-mismatch rejection path. Run withcargo test --test version_update -- --ignored.just checkpasses, including the builder-stage musl Docker compile (verifies reqwest + ring + rustls cross-compile cleanly).Note on the issue trailer
Per the repo's commit policy, the commit carries a bare
#MK-26(link only). The Forgejo VCS integration applies trailer commands at push time, not merge time, so aState Donetrailer would resolve the issue prematurely while this PR is still under review. State should move to Done on merge.