remove cobra v2 completion for plugins #4119
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fixes #3621
related to #3429
#3429 adds Cobra completion v2 support for commands and plugins. Since this change every invocation takes ~+60ms.
For
docker --version:docker-19.03.15docker-20.10.0docker-20.10.12docker-20.10.17docker-20.10.23docker-23.0.1docker-dev-pr-3419-a4b6fe1docker-dev-pr-3429-a09e61aSee the diff between
docker-dev-pr-3419-a4b6fe1anddocker-dev-pr-3429-a09e61a.Looking at the changes, we are now loading plugins for every invocation:
cli/cmd/docker/docker.go
Lines 230 to 233 in f5d698a
So the more plugins are in place in the user space, the worst it would be. And we have a lot of them in Docker Desktop atm:
- What I did
Remove completion for plugins to fix the regression.
Also wants to note that Cobra v2 completion is not implemented in our completion scripts atm. #3429 is just a preliminary work for Cobra v2 completion support afaik. If we want full support we need to revisit the completion scripts and remove hand-written funcs. We could rely on a single function and let Cobra do the completion. Pretty much like #4094 for plugins. All this to say that with this change it does not break the current workflow.
- How I did it
- How to verify it
Here is the benchmark result (see last row):
docker-19.03.15docker-20.10.0docker-20.10.12docker-20.10.17docker-20.10.23docker-23.0.1docker-dev-pr-3419-a4b6fe1docker-dev-pr-3429-a09e61adocker-dev-rm-plugins-completion- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)