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

Add support for internal plugins #902

Merged
merged 8 commits into from
Aug 25, 2020

Conversation

rhuss
Copy link
Contributor

@rhuss rhuss commented Jun 23, 2020

This PR adds the possibility for internal plugins. This works by allowing code to add to a global plugin slice plugins.InternalPlugins. By default this slice is empty, but for a custom assembly process (outside of this project), this could be leverage to add plugins directly in the code.

The changes are minimal and well tested, but the PR was created a bit in a hurry so apologies for not having an associated issue yet (but I will create on tomorrow).

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 23, 2020
@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Jun 23, 2020
@knative-prow-robot knative-prow-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jun 23, 2020
Copy link
Member

@mattmoor mattmoor left a comment

Choose a reason for hiding this comment

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

Produced via:
gofmt -s -w $(find -path './vendor' -prune -o -path './third_party' -prune -o -type f -name '*.go' -print)
goimports -w $(find -name '*.go' | grep -v vendor | grep -v third_party | grep -v wire_gen.go)

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.

Any chance to update the description or link to an issue?
This is listed as chore. Missing the context I guess.

@rhuss
Copy link
Contributor Author

rhuss commented Jun 24, 2020

Any chance to update the description or link to an issue?
This is listed as chore. Missing the context I guess.

Ah, sorry. It's kind of an habit to use the conventional commit spec for doing my commit message, and while creating the PR with hub it picked up this message as title by default.

Going to adapt the title, but there is no issue yet. Do you want me to create one or could we discuss the change on this PR ?

@rhuss rhuss changed the title chore: Add support for internal plugins Add support for internal plugins Jun 24, 2020
@rhuss
Copy link
Contributor Author

rhuss commented Jun 24, 2020

/hold

Do not merge until we have discussed the topic on an issue (which I will create tomorrow).

@knative-prow-robot knative-prow-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 24, 2020
@knative-prow-robot knative-prow-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 9, 2020
@rhuss rhuss force-pushed the pr/internal-plugins branch from 853461c to 6ce417a Compare July 13, 2020 06:26
@knative-prow-robot knative-prow-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 13, 2020
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.

Is this ready for review now that #929 is submitted?

@rhuss
Copy link
Contributor Author

rhuss commented Jul 14, 2020

I'm going to rebase this PR as soon as #929 is merged, but its already ready to review.

Please see also the proposal at #928 that I have opened.

/unhold

@knative-prow-robot knative-prow-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 14, 2020
@rhuss rhuss force-pushed the pr/internal-plugins branch from 6ce417a to 21322ab Compare July 14, 2020 12:58
@knative-prow-robot knative-prow-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 15, 2020
@rhuss rhuss force-pushed the pr/internal-plugins branch from 21322ab to b28cf16 Compare July 16, 2020 09:29
@knative-prow-robot knative-prow-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 16, 2020
Copy link
Member

@daisy-ycguo daisy-ycguo left a comment

Choose a reason for hiding this comment

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

Generally, the changes look good to me. Just a small suggestion to improve the test cases. Also I think we need to add a section to docs/plugins/README.md to describe this feature.

pkg/kn/plugin/manager_test.go Show resolved Hide resolved
@maximilien
Copy link
Contributor

/test pull-knative-client-integration-tests

@maximilien
Copy link
Contributor

maximilien commented Jul 27, 2020

@rhuss I am not able to checkout your PR. I get the following:

➜  client git:(master) gh pr checkout 902
From https://github.com/knative/client
 ! [rejected]          refs/pull/902/head -> pr/internal-plugins  (non-fast-forward)
exit status 1

Could it be a need to rebase? OR maybe I need to do something on my side... not sure. Let me digg some more

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.

Not able to checkout...

@rhuss
Copy link
Contributor Author

rhuss commented Jul 28, 2020

@maximilien looks strange. Ok, let me try (but I'm typically not using gh but standard git)

@rhuss
Copy link
Contributor Author

rhuss commented Jul 28, 2020

Hmm, I tried it with standard git commands, no issue. Maybe its a problem of gh ?

git clone https://github.com/knative/client.git
cd client
git remote add rhuss https://github.com/rhuss/knative-client.git
git fetch rhuss
git checkout -b internal-plugins rhuss/pr/internal-plugins

@rhuss rhuss force-pushed the pr/internal-plugins branch from b28cf16 to 157968f Compare August 24, 2020 07:45
@rhuss
Copy link
Contributor Author

rhuss commented Aug 24, 2020

/retest

2 similar comments
@rhuss
Copy link
Contributor Author

rhuss commented Aug 24, 2020

/retest

@rhuss
Copy link
Contributor Author

rhuss commented Aug 24, 2020

/retest

@rhuss
Copy link
Contributor Author

rhuss commented Aug 24, 2020

The integration test error is not a flake but because of a change in eventing 0.17. We need to fix this before releasing kn 0.17 regardless of whether we get this PR in or not.

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.

Getting consistent error trying to run tests locally. Some of the output below. Also reviewed the changes.

➜  client git:(master) ✗ ./hack/build.sh
🚒 Update
⚖️  License
📖 Docs
🚧 Compile
🧪 Test
🔥 Failure
# knative.dev/pkg/test/logging
/Users/maximilien/go/pkg/mod/knative.dev/[email protected]/test/logging/tlogger.go:186:5: o.t.Cleanup undefined (type *testing.T has no field or method Cleanup)
note: module requires Go 1.14
FAIL	knative.dev/client/cmd/kn [build failed]
?   	knative.dev/client/pkg/apis/client	[no test files]
?   	knative.dev/client/pkg/apis/client/v1alpha1	[no test files]
...
FAIL	knative.dev/client/pkg/kn/commands [build failed]
...
FAIL	knative.dev/client/pkg/kn/commands/completion [build failed]
...
FAIL	knative.dev/client/pkg/templates [build failed]
...

@rhuss
Copy link
Contributor Author

rhuss commented Aug 25, 2020

@maximilien knative now depends on go 1.14, so you need to upgrade your go installation

@knative-metrics-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-knative-client-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/kn/plugin/manager.go 87.1% 89.8% 2.8

@rhuss
Copy link
Contributor Author

rhuss commented Aug 25, 2020

@dsimansk @navidshaikh @maximilien I think we are good to merge. I adressed all PR comments, and added some extra testing. Also the CI is fixed (will also fix CI issues of other PRs).

Can I have a lgtm please ? (if there are no objections)

Copy link
Collaborator

@navidshaikh navidshaikh left a comment

Choose a reason for hiding this comment

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

/lgtm

@@ -73,6 +73,10 @@
| Add sugar controller to E2E tests
| https://github.com/knative/client/pull/920[#920]

| 🎁
| Add support for internal plugins
| https://github.com/knative/client/pull/880[#880]
Copy link
Collaborator

Choose a reason for hiding this comment

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

902, can be fixed in update to changelog PR for release as well.

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 25, 2020
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: navidshaikh, rhuss

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 merged commit a01861b into knative:master Aug 25, 2020
rhuss added a commit to rhuss/knative-client that referenced this pull request Aug 25, 2020
* chore: Add support for internal plugins

* added test for internal plugin lookup

* add changelog entry

* fix formatting

* update to latest changes on main

* Added more tests + some docs

* formatting fix

* moved to proper injection label for setting up the broker in integration test
@rhuss rhuss mentioned this pull request Aug 25, 2020
@navidshaikh navidshaikh added the backport/candidate Consider this PR to be backported to the release branch label Aug 25, 2020
knative-prow-robot pushed a commit that referenced this pull request Aug 25, 2020
* Add support for internal plugins (#902)

* chore: Add support for internal plugins

* added test for internal plugin lookup

* add changelog entry

* fix formatting

* update to latest changes on main

* Added more tests + some docs

* formatting fix

* moved to proper injection label for setting up the broker in integration test

* update changelog

* fix changelog
rhuss added a commit to rhuss/knative-client that referenced this pull request Sep 9, 2020
* chore: Add support for internal plugins

* added test for internal plugin lookup

* add changelog entry

* fix formatting

* update to latest changes on main

* Added more tests + some docs

* formatting fix

* moved to proper injection label for setting up the broker in integration test
@navidshaikh navidshaikh added backported-to/0.16 and removed backport/candidate Consider this PR to be backported to the release branch labels Oct 12, 2020
@navidshaikh navidshaikh modified the milestone: v0.17.0 Nov 23, 2020
@navidshaikh navidshaikh linked an issue Nov 23, 2020 that may be closed by this pull request
mgencur pushed a commit to openshift-knative/client that referenced this pull request Nov 21, 2022
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. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Proposal: Allow inlining of golang plugins
9 participants