mirror of
https://github.com/docker/cli.git
synced 2026-01-13 18:22:35 +03:00
Commitcbec75e2f3updated `runDocker()` to load plugin-stubs before `processAliases()` was executed. As a result, plugin stubs were considered as "builtin commands", causing the alias verification to fail; Without alias installed: ```bash docker version Client: Version: 22.06.0-beta.0-140-g3dad26ca2.m API version: 1.42 Go version: go1.19.1 Git commit:3dad26ca2Built: Wed Sep 28 22:36:09 2022 OS/Arch: darwin/arm64 Context: default ... ``` After running `docker buildx install`; ```bash ./build/docker buildx install cat ~/.docker/config.json { "aliases": { "builder": "buildx" } } ./build/docker version not allowed to alias with builtin "buildx" as target ``` This patch moves loading the stubs _after_ the call to `processAliases()`, so that verification passes. As an extra precaution, the `processAliases()` function is also updated to exclude plugin-stub commands. Note thatcbec75e2f3also introduced a performance regression, which may be related to the early loading of plugins (and creating stubs); it looks like various other code locations may also be loading plugins, for example `tryPluginRun()` calls `pluginmanager.PluginRunCommand()`, which also traverses plugin directories. We should look under what circumstances the plugin stub-commands are actually needed, and make sure that they're only created in those situations. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>