feat(upgrade): implement binary self update#10
Merged
Merged
Conversation
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
Implements
apimux upgradefor direct binary installs and makes schema-bound source command help resilient when the service schema cannot be reached.Motivation
apimux upgrade --checkalready reports newer releases, butapimux upgradereturnedcli_upgrade_not_implemented. Also, dynamic source command help could returncli_transport_errorif schema lookup failed, which makes help unusable in misconfigured/offline scenarios.Changes
update.Upgrade()to download the platform archive, verify checksums, extractapimux, and atomically replace the current executable.upgrade --checkas a non-mutating manifest check.--helpfall back to static help with a schema lookup warning instead of failing with transport errors.References
Implementation follows the existing
api-egress-gatewayupdate pattern: GitHub release asset download, checksum verification, tar extraction, and atomic rename.lark-cliwas also checked for install-side checksum/mirror practices.Testing
go test ./...git diff --checkgo run ./cmd/apimux --base-url http://127.0.0.1:1 amazon get_product --helpAPIMUX_CLI_RELEASE_MANIFEST_URL=https://github.com/reorc/apimux-cli/releases/latest/download/latest.json go run -ldflags "-X github.com/reorc/apimux-cli/internal/buildinfo.Version=1.1.4 -X github.com/reorc/apimux-cli/internal/buildinfo.ReleaseManifestURL=https://github.com/reorc/apimux-cli/releases/latest/download/latest.json" ./cmd/apimux upgrade --check