-
Notifications
You must be signed in to change notification settings - Fork 372
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
Clean up stale krew installations on windows #314
Clean up stale krew installations on windows #314
Conversation
This introduces a preRun check to root cmd. On windows, we determine the current version of krew from the installation receipt and clean all other directories in $KREW_ROOT/store/krew that aren't the current version, since we don't delete the install directory on post-upgrade if plugin name=="krew" (due to inability of deleting currently executed binary on win32). Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ahmetb The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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.
Looks good overall, but can you add a test for CleanupStaleKrewInstallations
?
} | ||
} else if f.Name() != newVersion { | ||
glog.V(1).Infof("Unlink krew installation under %q", pluginVersionPath) | ||
// TODO(ahmetb,lbb) is this part implemented??? |
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.
finally this cryptic todo is gone 🎉
return nil | ||
} | ||
|
||
func cleanupStaleKrewInstallations() error { |
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.
Too bad we can't cover this with integration tests, because it only targets windows where we don't run tests...
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.
we are able to emulate windows very easily by doing KREW_OS=windows here.
I just didn't think it was worth adding integration tests, because the upgrade path is fairly complex.
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.
Looks good overall, but can you add a test for CleanupStaleKrewInstallations
?
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
Done. |
Oops.. CI failed |
I hate this lint check 😄 |
Codecov Report
@@ Coverage Diff @@
## master #314 +/- ##
=========================================
+ Coverage 55.66% 57.3% +1.63%
=========================================
Files 19 19
Lines 918 904 -14
=========================================
+ Hits 511 518 +7
+ Misses 355 335 -20
+ Partials 52 51 -1
Continue to review full report at Codecov.
|
This should be good to go. |
Yeah, sorry for the delay. |
This introduces a preRun check to root cmd. On windows, we determine the
current version of krew from the installation receipt and clean all other
directories in $KREW_ROOT/store/krew that aren't the current version,
since we don't delete the install directory on post-upgrade if plugin
name=="krew" (due to inability of deleting currently executed binary on
win32).
Fixes #309.
/assign @corneliusweig