-
Notifications
You must be signed in to change notification settings - Fork 371
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
cmd: modify upgrade to work with multiple indexes #594
cmd: modify upgrade to work with multiple indexes #594
Conversation
This is kinda like #579 (should we do |
Oh right, I forgot that we decided on that in that issue. So just to be clear, we're going to do |
Yeah, whatever’s installed. Upgrade machinery should be primarily looking at the install receipts to figure out what that name resolves to. Also, I was hoping to add a check to |
I kinda misread what you meant about uninstall having that warning. For some reason I thought you meant you wanted me to add that in this PR but I realize you meant to add the same type of warning to upgrade. Let me know if you want me to remove that from this PR. |
I think it’s fine to update. But I think we should return it as err not warning. That way we can also test it. |
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.
/approve
Just minor nits from here. Nice work!
cmd/krew/cmd/upgrade.go
Outdated
if isCanonicalName(arg) { | ||
return errors.New("upgrade command does not support INDEX/PLUGIN syntax; just specify PLUGIN") | ||
} |
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.
nit: move that right before the enclosing if
cmd/krew/cmd/upgrade.go
Outdated
} | ||
r, err := receipt.Load(paths.PluginInstallReceiptPath(arg)) | ||
if err != nil { | ||
return errors.Wrapf(err, "receipt not found for %q", arg) |
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.
nit: we don't know what the error is
return errors.Wrapf(err, "receipt not found for %q", arg) | |
return errors.Wrapf(err, "read receipt %q", arg) |
cmd/krew/cmd/uninstall.go
Outdated
if isCanonicalName(name) { | ||
return errors.New("uninstall command does not support INDEX/PLUGIN syntax; just specify PLUGIN") | ||
} |
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.
nit: move in right before the enclosing if.
Any final reviews would be much appreciated when you guys get some spare time 😄 |
cmd/krew/cmd/upgrade.go
Outdated
} | ||
if !validation.IsSafePluginName(arg) { |
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.
can do else if
here
/approve |
0a515f3
to
9ab6eb2
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ahmetb, chriskim06, corneliusweig 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 |
Upgrade was already refactored to support adding indexes to receipts so this was a pretty simple change + integration test. Upgrade works with:
kubectl krew upgrade
kubectl krew upgrade plugin ... // plugin can be default/plugin or foo/plugin
Also added warning text to uninstall when user tries to uninstall by canonical name.
Related issue: #566
/area multi-index