[v2] Implement update command#10475
Open
hssyoo wants to merge 2 commits into
Open
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.
Implements
aws updatecommand to download and install the latest AWS CLI v2 version. Also change Linux and macOS post-install scripts to write install-time metadata atinstall.json.At a high-level, the command does the following:
install.jsonto see if there's a record of the exact install and bin path of the current CLI instance.a. Unix should always have it since this PR also introduces post-install changes that ensure
install.jsonis written. One caveat is that the bin directory may not have been recorded (if the user manually set up symlinks). In that case, the command skips setting up a symlink. This is fine since the user-created symlink will still point to the install directory that we're writing over.b. Windows may not necessarily have it because there's no Windows post-install script that creates one in the case that the MSI was used directly (ie without an install script or
updatecommand). This is fine because Windows MSIs install to predetermined paths.install.jsonto see if the current instance was a system install. If unavailable, then a best effort will be made based on the current CLI path.a. Unix updates are straightforward since the OS caches the inode and so it can be updated in-place while the updated exe is still running.
b. Windows is trickier since the process acquires a lock on the exe. To work around this, the parent process exits early after launching a detached subprocess that handles the install execution.