-
Notifications
You must be signed in to change notification settings - Fork 10
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
Stop execution if tool version already installed #49
base: main
Are you sure you want to change the base?
Conversation
feb2285
to
ec09670
Compare
ec09670
to
38108f6
Compare
$blktVersion = ($blktVersion.Split(' ')[2]).TrimStart('v') | ||
Write-Debug "{ User Version: $userVersion, Current Version: $blktVersion }" | ||
if ($userVersion -eq $blktVersion) { | ||
Write-Warning "Installed Buildkit version is the same as the requested version. Please uninstall the existing version using 'Uninstall-Containerd' or use -Force to reinstall." |
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.
Messaging is inconsistent, Uninstall-Containerd
in buildkit warning
# Check if tool already exists at specified location | ||
if ($isInstalled) { | ||
$errMsg = "Containerd already exists at $InstallPath or the directory is not empty" | ||
Write-Warning $errMsg | ||
|
||
# Check if user wants to install an already installed version | ||
Write-Debug "Containerd executable: $ctrexe" | ||
$cmdOutput = Invoke-ExecutableCommand -Executable "$ctrexe" -Arguments "--version" |
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.
containerd, nerdctl and buildkit version checks look similar, perhaps break this logic out into utilities
PR description
Background information
When the version of a tool is already installed, the
Install-Command
uninstalls then reinstalls the tool. To fix this, if the tool version is already installed, the script will stop execution and show the user a warning. If a user must reinstall it, they can pass-Force
flag when running the command.Github issue
#20
Testing information
Check installed buildkit version
Try to install an already installed version
Should show user a warning and stop installation
Force install an already installed version
Should show use a warning, proceed to uninstall the installed version, then re-install the version
Checklist
As part of our commitment to engineering excellence, before submitting this PR, please make sure:
In addition, after this PR has been reviewed, please agree to: