Skip to content

cli-plugins/manager: use shallower interface#5892

Merged
thaJeztah merged 2 commits intodocker:masterfrom
thaJeztah:pluginmanager_smaller_interface
Mar 5, 2025
Merged

cli-plugins/manager: use shallower interface#5892
thaJeztah merged 2 commits intodocker:masterfrom
thaJeztah:pluginmanager_smaller_interface

Conversation

@thaJeztah
Copy link
Copy Markdown
Member

The manager only requires the CLI's configuration; define a shallow interface for this so that we don't have to import cli/command.

In addition to the CLI's configuration, runHooks also used the CLI's configured StdErr output. We set the Cobra input and output streams to be the same as the DockerCLI outputs in newDockerCommand and newPluginCommand, so we can get this from the Cobra command.

- Human readable description for the release notes

- A picture of a cute animal (not mandatory but encouraged)

@thaJeztah thaJeztah added status/2-code-review area/plugins kind/refactor PR's that refactor, or clean-up code labels Mar 5, 2025
@thaJeztah thaJeztah added this to the 28.0.2 milestone Mar 5, 2025
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 5, 2025

Codecov Report

Attention: Patch coverage is 21.73913% with 18 lines in your changes missing coverage. Please review.

Project coverage is 59.28%. Comparing base (ea1f10b) to head (4be2dde).
Report is 8 commits behind head on master.

❌ Your patch status has failed because the patch coverage (21.73%) is below the target coverage (50.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5892      +/-   ##
==========================================
- Coverage   59.29%   59.28%   -0.01%     
==========================================
  Files         355      355              
  Lines       29753    29758       +5     
==========================================
+ Hits        17641    17643       +2     
- Misses      11140    11143       +3     
  Partials      972      972              

Comment on lines +116 to +119
// ConfigProvider defines an interface for providing the CLI config.
type ConfigProvider interface {
ConfigFile() *configfile.ConfigFile
}
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Actually now starting to consider if we should move this interface into cli/config or cli/config/configfile, as there's quite some places where all we're looking for is the Config 🤔

The manager only requires the CLI's configuration; define a shallow interface
for this so that we don't have to import cli/command.

In addition to the CLI's configuration, `runHooks` also used the CLI's configured
StdErr output. We set the Cobra input and output streams to be the same as the
DockerCLI outputs in [newDockerCommand] and [newPluginCommand], so we can
get this from the Cobra command.

[newDockerCommand]: https://github.com/docker/cli/blob/ea1f10b440370997b8ff2c78602b249236c34f4a/cmd/docker/docker.go#L148-L150
[newPluginCommand]: https://github.com/docker/cli/blob/ea1f10b440370997b8ff2c78602b249236c34f4a/cli-plugins/plugin/plugin.go#L166-L168

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Makes sure we implement that interface, and don't diverge.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah thaJeztah force-pushed the pluginmanager_smaller_interface branch from a3e49b0 to 4be2dde Compare March 5, 2025 11:06
@thaJeztah thaJeztah merged commit e558b91 into docker:master Mar 5, 2025
95 checks passed
@thaJeztah thaJeztah deleted the pluginmanager_smaller_interface branch March 5, 2025 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/plugins kind/refactor PR's that refactor, or clean-up code status/2-code-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants