-
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
Fix plugin inlining that uses client-pkg dependency #1816
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #1816 +/- ##
==========================================
- Coverage 79.74% 79.73% -0.01%
==========================================
Files 179 179
Lines 13890 13898 +8
==========================================
+ Hits 11076 11081 +5
- Misses 2052 2054 +2
- Partials 762 763 +1
☔ View full report in Codecov by Sentry. |
IIUC this is about moving the pluginmanager to If this is correct, the chance makes totally sense. However, I would also remove moved parts from the client hier as well. |
Yep, that's exact summary. I'll clean up the moved parts in a big bang sweep. :) |
/lgtm |
@vyasgun sorry, rebased now. :) |
/lgtm |
/retest |
/lgtm |
cmd/kn/main.go
Outdated
// Merge plugins that implements client-pkg Plugin type to the same manager instance | ||
for _, p := range pkgplugin.InternalPlugins { | ||
pluginManager.AppendPlugin(p) | ||
} | ||
|
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.
This part is important!
There're 2 gloabal variables:
client
InternalPlugins
client-pkg
InternalPlugins
Depending in the plugin impl both are still valid, either by using new depedency or former on client repo. Therefore there's list merge to a single one that is used onward. I.e. content of client-pkg
list is merged into client
list.
/retest |
cmd/kn/main.go
Outdated
@@ -62,6 +64,11 @@ func run(args []string) error { | |||
|
|||
pluginManager := plugin.NewManager(config.GlobalConfig.PluginsDir(), config.GlobalConfig.LookupPluginsInPath()) | |||
|
|||
// Merge plugins that implements client-pkg Plugin type to the same manager instance | |||
for _, p := range pkgplugin.InternalPlugins { |
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.
I wonder whether we shouldn't put this internally in plugin.NewManager() where it feels more natural to me. It could be a lazy initialization (i.e. do only once regardless how often NewManager() is called). It would also keep main()
a bit cleaner.
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.
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.
Does it look better now? Agreed on moving the scope to constructor.
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.
@rhuss ping if you get to 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.
thanks! (sorry, missed that ping)
/approve
/lgtm
/retest |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dsimansk, 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 |
* Fix plugin inlining that uses client-pkg dependency * Move list merge into plugin manager * Fix imports formatting
Description
Changes
This moves the initialization to new
client-pkg
, otherwise the inlined plugins depending on client-pkg aren't recognized as expected./cc @rhuss @vyasgun
Reference
Fixes #
Release Note