Repository navigation
fix(update): compare versions as semver and replace the binary safely - #22
Merged
Merged
Conversation
- Compare versions with golang.org/x/mod/semver (v0.1.10 is newer than v0.1.9). A git describe build (v0.1.1-2-gabc) counts as its tag. A build that is not from a release tag (dev) cannot be compared: fly update says so and asks before it installs. - Get the release one time, with a 60 s timeout, a User-Agent and a status check. A GitHub rate limit gives a clear error instead of 'already running the latest version'. - Extract the binary with archive/tar and compress/gzip instead of the tar command. - Write the new binary to a temporary file next to the executable and rename it, so the rename cannot cross filesystems (EXDEV). The old binary stays unchanged when the update fails. - Release asset names and archive layout are unchanged. Closes #8
nabil1440
force-pushed
the
blockers/8-self-update
branch
from
September 22, 2026 06:36
c106f5c to
062e0a7
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.
Change
golang.org/x/mod/semvercompares the versions. Thusv0.1.10is newer thanv0.1.9.git describeversion (v0.1.1-2-gabc,-dirty) counts as its tag.flycannot compare a build that is not from a release tag (dev).fly updatetells this and asks before it installs the latest release.flyreads the release information one time, with a 60 s timeout, aUser-Agentheader and a status check.archive/tarandcompress/gzipextract the binary. The code does not start thetarcommand.Tests
httptest): 200, 403 rate limit, 500, and a response without a tag/tmpis on tmpfs. A local server replaces GitHub:/usr/local/bin.golangci-lintshows 0 issues on the full repository.govulncheckfinds no vulnerabilities.Closes #8