-
Notifications
You must be signed in to change notification settings - Fork 2k
[28.x backport] cli-plugins/manager: various fixes and deprecations #6269
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
Merged
thaJeztah
merged 8 commits into
docker:28.x
from
thaJeztah:28.x_backport_plugin_manager_unexport
Aug 18, 2025
Merged
[28.x backport] cli-plugins/manager: various fixes and deprecations #6269
thaJeztah
merged 8 commits into
docker:28.x
from
thaJeztah:28.x_backport_plugin_manager_unexport
Aug 18, 2025
Conversation
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
Ah; we're probably still using
Let me have a look |
1 task
4015634
to
b29ec52
Compare
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
ab70659
to
16e059b
Compare
It is for internal use for mocking purposes, and is not part of any public interface / signature. Signed-off-by: Sebastiaan van Stijn <[email protected]> (cherry picked from commit 54367b3) Signed-off-by: Sebastiaan van Stijn <[email protected]>
Go does not by default marshal `error` type fields to JSON. The manager package therefore implemented a `pluginError` type that implements [encoding.TextMarshaler]. However, the field was marked as a regular `error`, which made it brittle; assining any other type of error would result in the error being discarded in the marshaled JSON (as used in `docker info` output), resulting in the error being marshaled as `{}`. This patch adds a custom `MarshalJSON()` on the `Plugin` type itself so that any error is rendered. It checks if the error used already implements [encoding.TextMarshaler], otherwise wraps the error in a `pluginError`. [encoding.TextMarshaler]: https://pkg.go.dev/encoding#TextMarshaler Signed-off-by: Sebastiaan van Stijn <[email protected]> (cherry picked from commit 549d39a) Signed-off-by: Sebastiaan van Stijn <[email protected]>
It is for internal use, and no longer needed for testing, now that the `Plugin` type handles marshalling errors. Signed-off-by: Sebastiaan van Stijn <[email protected]> (cherry picked from commit 1cc698c) Signed-off-by: Sebastiaan van Stijn <[email protected]>
These errors satisfy errdefs.IsNotFound, so make it a wrapper, and deprecate it. Signed-off-by: Sebastiaan van Stijn <[email protected]> (cherry picked from commit 7146021) Signed-off-by: Sebastiaan van Stijn <[email protected]>
We no longer depend on this interface and it implements Unwrap for native handling by go stdlib. Signed-off-by: Sebastiaan van Stijn <[email protected]> (cherry picked from commit d789bac) Signed-off-by: Sebastiaan van Stijn <[email protected]>
This was a pattern inheritted from pkg/errors.Wrapf, which ignored nil errors for convenience. However, it is error-prone, as it is not obvious when returning a nil-error. All call-sites using `wrapAsPluginError` already do a check for nil errors, so remove this code to prevent hard to find bugs. Signed-off-by: Sebastiaan van Stijn <[email protected]> (cherry picked from commit 50963ac) Signed-off-by: Sebastiaan van Stijn <[email protected]>
These aliases were added in 4321293 (part of v28.0), but did not deprecate them. They are no longer used in the CLI itself, but may be used by cli-plugin implementations. This deprecates the aliases in `cli-plugins/manager` in favor of their equivalent in `cli-plugins/manager/metadata`: - `NamePrefix` - `MetadataSubcommandName` - `HookSubcommandName` - `Metadata` - `ReexecEnvvar` Signed-off-by: Sebastiaan van Stijn <[email protected]> (cherry picked from commit 5876b29) Signed-off-by: Sebastiaan van Stijn <[email protected]>
This const was deprecated in 9dc175d, which is part of v28.0, so let's remove it. Signed-off-by: Sebastiaan van Stijn <[email protected]> (cherry picked from commit 513ceee) Signed-off-by: Sebastiaan van Stijn <[email protected]>
16e059b
to
79e0b1d
Compare
Benehiko
approved these changes
Aug 18, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area/go-sdk
Changes affecting the Go SDK
area/plugins
impact/deprecation
impact/go-sdk
Noteworthy (compatibility changes) in the Go SDK
status/2-code-review
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.
cli-plugins/manager: un-export "Candidate" interface
It is for internal use for mocking purposes, and is not part
of any public interface / signature.
cli-plugins/manager: fix Plugin marshaling with regular errors
Go does not by default marshal
error
type fields to JSON. The managerpackage therefore implemented a
pluginError
type that implementsencoding.TextMarshaler. However, the field was marked as a regular
error
, which made it brittle; assining any other type of error wouldresult in the error being discarded in the marshaled JSON (as used in
docker info
output), resulting in the error being marshaled as{}
.This patch adds a custom
MarshalJSON()
on thePlugin
type itselfso that any error is rendered. It checks if the error used already
implements encoding.TextMarshaler, otherwise wraps the error in
a
pluginError
.cli-plugins/manager: un-export "NewPluginError"
It is for internal use, and no longer needed for testing, now that
the
Plugin
type handles marshalling errors.cli-plugins/manager: deprecate "IsNotFound"
These errors satisfy errdefs.IsNotFound, so make it a wrapper, and
deprecate it.
cli-plugins/manager: pluginError: remove Causer interface
We no longer depend on this interface and it implements Unwrap for
native handling by go stdlib.
cli-plugins/manager: wrapAsPluginError: don't special-case nil
This was a pattern inheritted from pkg/errors.Wrapf, which ignored
nil errors for convenience. However, it is error-prone, as it is
not obvious when returning a nil-error.
All call-sites using
wrapAsPluginError
already do a check fornil errors, so remove this code to prevent hard to find bugs.
cli-plugins/manager: deprecate metadata aliases
These aliases were added in 4321293
(part of v28.0), but did not deprecate them. They are no longer used
in the CLI itself, but may be used by cli-plugin implementations.
This deprecates the aliases in
cli-plugins/manager
in favor oftheir equivalent in
cli-plugins/manager/metadata
:NamePrefix
MetadataSubcommandName
HookSubcommandName
Metadata
ReexecEnvvar
cli-plugins/manager: remove deprecated ResourceAttributesEnvvar
This const was deprecated in 9dc175d,
which is part of v28.0, so let's remove it.
- Human readable description for the release notes
- A picture of a cute animal (not mandatory but encouraged)