-
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
feat: CLI can self-update when there is a new version and properly continue proving #62
Conversation
Visit the preview URL for this PR (updated for commit 487a6fc): https://nexus-cli--pr62-dprats-cli-self-upda-xbzt1ko0.web.app (expires Wed, 04 Dec 2024 00:20:13 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 815ec4c632754f56eccfacfc0919559f5a85a0f1 |
…dprats/cli-self-update
…dprats/cli-self-update
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left a few comments, but nonblocking
Auto-updating CLI
This PR implements automatic updates for the CLI, allowing users to always run the latest version without manual intervention.
User Flow
install.sh
test
mode, 5 minutes inproduction
mode, all configurable viaUpdaterConfig
)Modes
The auto updater has two modes: as seen here:
Production
mode runs every 5 minutes and checks the git remote for the latest tags and versions.Test
runs every 30 seconds and checks the local git repo for latest tags. This is used for testing.Implementation and notable changes
/prover.rs
: Integration with main CLI <-- this is the main file we always use/updater.rs
: Core update logic <-- this is a new fileutils/updater.rs
: Core update logic <-- this is a new file with helper functiontests/test_updater.sh
: End-to-end testing <-- this is a new file which is a bash script used for testingThreads/Processes Logic
The auto-updater manages updates through threads and processes:
Goal: Enable automatic updates that does interrupt proving operations, but restarts them with the new code running.
Color Printing (and other similar updates)
To make things easier to understand here are the highlights of the changes:
test_updater.sh
) I created that pretends to be a user, starts up the CLI, changes git tag, waits to see if the CLI notices the updates and checks if the CLI re-updated and CLI restarted itselfprover.rs
logic in the main threadupdater.rs
which is called byprover.rs
) that checks for any new updates