Skip to content
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

Updating install location for quickstart plugin #24

Merged

Conversation

psschwei
Copy link
Contributor

Changes

  • 🎁 Update the plugin install location to be ~/.config/kn/plugins so that it will be discoverable by kn

/kind enhancement

Fixes #23

Please double check this... I ran the commands through irb and everything seems to be correct, but I don't have a working homebrew to fully test out this change.

/assign @rhuss

@google-cla google-cla bot added the cla: yes Indicates the PR's author has signed the CLA. label Jul 22, 2021
@knative-prow-robot knative-prow-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jul 22, 2021
@psschwei
Copy link
Contributor Author

comment from @julz in slack: seems probably best to fix by respecting PATH so it works for all plugins, not just QuickStart (and so brew install works for all users, not just the one who ran the brew command; also consistent with other plugins with similar model, like git/kubectl etc)

@csantanapr
Copy link

I agree with @psschwei and @julz the kn CLI should use the PATH to search for plugin same way as kubectl

I think we should merge this, and once kn is released with the capability to search in PATH then we can make new versions of quickstart plugin install in bin PATH

@maximilien
Copy link
Contributor

@csantanapr kn has and always had the ability to search for plugins in PATH. It's just not the default. Users can enable by setting up that in config.yml options path-lookup

Copy link
Contributor

@maximilien maximilien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment about kn search for plugins

quickstart.rb Outdated
if OS.mac?
FileUtils.mv("kn-quickstart-darwin-amd64", "kn-quickstart")
FileUtils.mv("kn-quickstart-darwin-amd64", Dir.home + "/.config/kn/plugins/kn-quickstart")
Copy link
Contributor

@maximilien maximilien Jul 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've debated this... on the one hand installing in the normal location by brew would allow easy clean up. But that requires users to specify lookup in path for kn. See my comment above.

Ideally a symlink would be better since that would allow both PATH and lookup-path to work

@julz
Copy link

julz commented Jul 23, 2021

@maximilien do you remember why we didn't/is there any reason we shouldn't make that the default, matching git/kubectl? (otherwise it's not much use because in terms of this use case since we can't really expect users to edit a json file to install a "Quick"Start plugin :))

@maximilien
Copy link
Contributor

maximilien commented Jul 23, 2021

Long discussion @julz way back when I submitted first PR for plugins in fall 2018. It actually looked up in PATH by default since I was trying to keep it like kubectl but lots of push backs and reasoning that I actually agree with for a central plugin repo while also allowing PATH lookup. So we ended up where we are.

I suggested a way out to @psschwei that might work. See comment above about symlink.

@psschwei
Copy link
Contributor Author

Long discussion ...

Right before I saw this, I opened knative/client#1399 about changing the default behavior. If that discussion has already been had, then feel free to close. But if perhaps given that some time has passed, maybe it's worth revisiting?

@julz
Copy link

julz commented Jul 23, 2021

lots of push backs and reasoning

Any chance these are documented anywhere so I could read up? Without wanting to dredge up a solved issue, I would love to understand more because the advantage of working consistently with git/kubectl, and of working out of the box with brew without writing stuff in to a home dir (which will only work for the user that happened to run brew..) seem quite compelling.

Copy link
Contributor

@maximilien maximilien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/ok-to-test
/approve
/lgtm

@knative-prow-robot knative-prow-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. lgtm Indicates that a PR is ready to be merged. labels Jul 23, 2021
@knative-prow-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: maximilien, psschwei

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 23, 2021
@knative-prow-robot knative-prow-robot merged commit 8cad0e8 into knative-extensions:main Jul 23, 2021
@maximilien
Copy link
Contributor

I approved this too fast. There are some issues we need to resolve @psschwei. First, the require 'Dir' may not be something we can do in a formulae. When I tested it manually I get:

Error: quickstart: cannot load such file -- Dir
/usr/local/Homebrew/Library/Homebrew/formulary.rb:84:in `rescue in block in load_formula'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:77:in `block in load_formula'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:90:in `load_formula'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:110:in `load_formula_from_path'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:195:in `load_file'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:185:in `klass'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:180:in `get_formula'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:412:in `factory'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:116:in `resolve'
/usr/local/Homebrew/Library/Homebrew/cli/named_args.rb:170:in `resolve_formula'
/usr/local/Homebrew/Library/Homebrew/cli/named_args.rb:106:in `load_formula_or_cask'
/usr/local/Homebrew/Library/Homebrew/cli/named_args.rb:59:in `block in to_formulae_and_casks'
/usr/local/Homebrew/Library/Homebrew/cli/named_args.rb:58:in `each'
/usr/local/Homebrew/Library/Homebrew/cli/named_args.rb:58:in `flat_map'
/usr/local/Homebrew/Library/Homebrew/cli/named_args.rb:58:in `to_formulae_and_casks'
/usr/local/Homebrew/Library/Homebrew/cli/named_args.rb:176:in `to_resolved_formulae'
/usr/local/Homebrew/Library/Homebrew/dev-cmd/test.rb:45:in `test'
/usr/local/Homebrew/Library/Homebrew/brew.rb:131:in `<main>'

@maximilien
Copy link
Contributor

And 'Dir' is usually included in Ruby processes so you don't normally need to require it. I tried to remove it same thing...

I suggest trying to test manually with: brew test --debug --verbose ./quickstart.rb

@maximilien
Copy link
Contributor

Can you revert your changes please... as we work on figuring out a solution. Thx.

psschwei added a commit to psschwei/homebrew-kn-plugins that referenced this pull request Jul 23, 2021
knative-prow-robot pushed a commit that referenced this pull request Jul 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cla: yes Indicates the PR's author has signed the CLA. kind/enhancement lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Quickstart plugin not findable by kn
6 participants