cli-plugins/manager: use shallower interface#5892
Merged
thaJeztah merged 2 commits intodocker:masterfrom Mar 5, 2025
Merged
Conversation
Codecov ReportAttention: Patch coverage is
❌ 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 |
thaJeztah
commented
Mar 5, 2025
cli-plugins/manager/manager.go
Outdated
Comment on lines
+116
to
+119
| // ConfigProvider defines an interface for providing the CLI config. | ||
| type ConfigProvider interface { | ||
| ConfigFile() *configfile.ConfigFile | ||
| } |
Member
Author
There was a problem hiding this comment.
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>
a3e49b0 to
4be2dde
Compare
vvoland
approved these changes
Mar 5, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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,
runHooksalso 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)