-
Notifications
You must be signed in to change notification settings - Fork 263
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
refactor(plugins): Improved and simplified verifier and plugin list #313
refactor(plugins): Improved and simplified verifier and plugin list #313
Conversation
5efbc97
to
c2bd8d2
Compare
Note to reviewers: As this a refactoring PR the diff is not easy to read. All changes are confined to the I suggest to start at those files with these entry points:
|
a07bdb1
to
a0ce710
Compare
/retest |
1 similar comment
/retest |
52beec1
to
cc7667d
Compare
@rhuss I will get to this next week. Lots of things to tie up this week and also taking a few days off for a quick trip to London. I will move this up my TODO list once I am back or if I have WiFi in plane on Tuesday. Promise :) |
Can you also address this:
That's just weird output ;-) and
Should be empty.
It should show nothing IMO |
The later error message could be improved to say "No plugins are found in ~/.kn/plugins nor in your path" if path lookup is enable |
Yes, that could be done, too. I suggest to print nothing, but with |
I don't see the value in showing this - let it be controlled via |
Yep. I tend to look at things like this from two perspectives:
yuck!! ;-) |
/retest |
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.
Actually not bad to review at all :)
* Added proper executable check for current user * Refactor plugin_list to make it more straightforward * Seperate errors and warnings * Don't return an error when no plugin is installed and `plugin list` is called * Simplified tests * Check assumption that a prefix is given in verify()
E.g. if u-x, g+x and the user has the group of the file, but is also owner of the file then he is not allowed to execute the file.
Also, allow symlinks without warnings.
cc7667d
to
4cafffd
Compare
/retest |
pluginsDir = filepath.Join(tmpPathDir, "plugins") | ||
pluginsDirFlag = fmt.Sprintf("--plugins-dir=%s", pluginsDir) | ||
func (ctx *testContext) createTestPluginWithPath(pluginName string, fileMode os.FileMode, path string) error { | ||
if runtime.GOOS == "windows" { |
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.
Nice. I completely forgot and ignored Windows users. But good on this.
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.
Though I have no way to test actual Windows 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.
same for me ;-( I think we need at least a CI test suite somehow. I wonder how other CLI's like kubectl does it ?
} | ||
} | ||
|
||
func printLabelWithConditionalPluralS(out io.Writer, label string, nr int) { |
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.
...PluralS
... why not ...Plurals
?
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.
Because I refer to the plural "S" to be added at the end, and I don't refer to the plural of plural ;-) (which would be "plurals", supposed that something like this exists)
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.
OK cool... weird, but cool :)
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.
Overall looks good. Left some comments, mostly minor. I still think we should make plugin list
verbose by default since the point of the command in my view is to allow the user to see the various plugins available. It’s important that she knows which plugins are valid, executable, and “ready” versus those that are causing problems since otherwise how would she know? So overall for me errors and warnings are important to give as much info as possible to the user for that command.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: maximilien, rhuss, sixolet 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 |
warnings and errors are printed even without |
The following is the coverage report on pkg/.
|
/retest |
/lgtm |
* Add RPM SPEC file Minimize the file diff between midstream and downstream. * Update RELEASE.md with instructions to update SPEC file and Dockerfile.cliartifacts.rhel * Remove gcc from BuildRequires
* Add image to back up artifacts This copies images from gcr.io/knative-releases into the gcr.io/knative-backups registry using gcrane. This also copies knative release yamls (kube manifests) from gs://knative-releases to gs://knative-backups using gsutil. * Add job to back up artifacts This just wires up the prow config to use the backups image. * Properly escape $ in shell command in Makefile Co-Authored-By: jonjohnsonjr <[email protected]> * Remove resource requests
First sweep:
plugin list
is called~/
(not~
) must be expanded only when at the beginning of a path)After this:
This PR is a result of the discussion on #249 where we agreed to merge now (as the PR has been aged and grown considerably) but work on improvements right after.