-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: auto-updater bug fixes #75
Merged
Merged
Conversation
This file contains 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
Visit the preview URL for this PR (updated for commit 071cc87): https://nexus-cli--pr75-dprats-binary-update-rye1pmyl.web.app (expires Wed, 11 Dec 2024 22:08:56 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 815ec4c632754f56eccfacfc0919559f5a85a0f1 |
collinjackson
approved these changes
Dec 4, 2024
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.
This PR refactors the self-updater functionality to be more reproducible and easier to test.
Here are the main changes:
The problem with above:
self_update
crate is that it means i could delete lots of code i previously had since that crate handledThe main changes with this PR:
self_update
crate was used to replace a running executable/tests/updater.sh
test that builds the code and pulls the latest executable.How I tested this PR
This PR was tested in the following way:
1. I would compile a executable and manually upload it to the
0.3.7
tag (see below)2. In my local source code, I would make two small changes:
a. Change the
cargo.toml
version from0.3.7
to0.3.6
b. Comment out
pub const UPDATER_COLOR: &str = BLUE;
and un-commentpub const UPDATER_COLOR: &str = GREEN;
By doing the above the color of the
[auto-updater]
for0.3.7
remained blue (like below)...... while making the color of the
[auto-updater]
for0.3.6
(in my local source code) became green...This means that I would run code with green logging while the executable had blue logging. If the update properly worked, then it would switch colors on me while running. This means code can be deployed and the CLI self-updates
3. I would run the code locally and watch as my locally code "self-updated"
(see how the colors changed in the terminal after the executable self-updated)
Caveats
1. Github rate limiting - Github does throttle API requests (by IP) checking for latest versions of public repos like this one. I followed best practices (like setting user agents) so Github gives this wide berth. I believe this means we can get 50 pings from the same IP per hour. This should be enough for most people (but I did hit this limit many times while testing massive tests).
2. Other architectures - I have only uploaded the architecture for apple M1/M2 chip. The code should work with all the major ones (that is the intent of
self_update
) but this has only been tested with one architecture.3. CI - This PR does not create CI integration for making compiled builds... right now its manual, Automation can be a different PR.