Skip to content

move cli-plugins metadata types/consts to a separate package - #5902

Merged
thaJeztah merged 2 commits into
docker:masterfrom
thaJeztah:cli_plugin_metadata
Mar 7, 2025
Merged

move cli-plugins metadata types/consts to a separate package#5902
thaJeztah merged 2 commits into
docker:masterfrom
thaJeztah:cli_plugin_metadata

Conversation

@thaJeztah

@thaJeztahthaJeztah commented Mar 7, 2025

Copy link
Copy Markdown
Member

move cli-plugins metadata types/consts to a separate package

This prevents cli-plugins having to import the plugin-manager.

move cli-plugins annotation consts to a separate package

- Human readable description for the release notes

Go SDK: Move various types and consts from `cli-plugins/manager` to a separate package.

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

This prevents cli-plugins having to import the plugin-manager.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztahthaJeztah added status/2-code-review area/plugins kind/refactor PR's that refactor, or clean-up code area/go-sdk Changes affecting the Go SDK impact/go-sdk Noteworthy (compatibility changes) in the Go SDK labels Mar 7, 2025
@thaJeztah
thaJeztahforce-pushed the cli_plugin_metadata branch from 48b4e5c to 292713cCompareMarch 7, 2025 13:48
@codecov-commenter

codecov-commenter commented Mar 7, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 40.62500% with 19 lines in your changes missing coverage. Please review.

Project coverage is 59.29%. Comparing base (ceef542) to head (292713c).
Report is 3 commits behind head on master.

❌ Your patch status has failed because the patch coverage (40.62%) 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 #5902 +/- ##
==========================================
+ Coverage 59.26% 59.29% +0.02% 
==========================================
Files 357 357 Lines 29771 29771 ==========================================
+ Hits 17645 17653 +8 + Misses 11153 11144 -9 - Partials 973 974 +1 
🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

"os"

"github.com/docker/cli/cli-plugins/manager"
"github.com/docker/cli/cli-plugins/metadata"

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Went a bit back-and-forth what made most sense;

  • "github.com/docker/cli/cli-plugins/plugin/metadata"
  • "github.com/docker/cli/cli-plugins/metadata"

In the end, decided on the last one (for now), because it's shared between both, but let me know what you think!

Comment on lines +3 to +28
const (
// CommandAnnotationPlugin is added to every stub command added by
// AddPluginCommandStubs with the value "true" and so can be
// used to distinguish plugin stubs from regular commands.
CommandAnnotationPlugin = "com.docker.cli.plugin"

// CommandAnnotationPluginVendor is added to every stub command
// added by AddPluginCommandStubs and contains the vendor of
// that plugin.
CommandAnnotationPluginVendor = "com.docker.cli.plugin.vendor"

// CommandAnnotationPluginVersion is added to every stub command
// added by AddPluginCommandStubs and contains the version of
// that plugin.
CommandAnnotationPluginVersion = "com.docker.cli.plugin.version"

// CommandAnnotationPluginInvalid is added to any stub command
// added by AddPluginCommandStubs for an invalid command (that
// is, one which failed it's candidate test) and contains the
// reason for the failure.
CommandAnnotationPluginInvalid = "com.docker.cli.plugin-invalid"

// CommandAnnotationPluginCommandPath is added to overwrite the
// command path for a plugin invocation.
CommandAnnotationPluginCommandPath = "com.docker.cli.plugin.command_path"
)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Didn't mark these as deprecated yet (nor did I remove the GoDoc strings); we could if we wanted to though.

@thaJeztahthaJeztah added this to the 28.0.2 milestone Mar 7, 2025
@thaJeztah

Copy link
Copy Markdown
MemberAuthor

cc @Benehiko@vvoland ptal 🤗

Comment on lines -12 to -38
const (
// CommandAnnotationPlugin is added to every stub command added by
// AddPluginCommandStubs with the value "true" and so can be
// used to distinguish plugin stubs from regular commands.
CommandAnnotationPlugin = "com.docker.cli.plugin"

// CommandAnnotationPluginVendor is added to every stub command
// added by AddPluginCommandStubs and contains the vendor of
// that plugin.
CommandAnnotationPluginVendor = "com.docker.cli.plugin.vendor"

// CommandAnnotationPluginVersion is added to every stub command
// added by AddPluginCommandStubs and contains the version of
// that plugin.
CommandAnnotationPluginVersion = "com.docker.cli.plugin.version"

// CommandAnnotationPluginInvalid is added to any stub command
// added by AddPluginCommandStubs for an invalid command (that
// is, one which failed it's candidate test) and contains the
// reason for the failure.
CommandAnnotationPluginInvalid = "com.docker.cli.plugin-invalid"

// CommandAnnotationPluginCommandPath is added to overwrite the
// command path for a plugin invocation.
CommandAnnotationPluginCommandPath = "com.docker.cli.plugin.command_path"
)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Are these used by other plugins? Should we deprecate and alias before removing?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Oh! There are aliases, but moved to a separate file; see further up; cli-plugins/manager/annotations.go

I think I had that move in a separate commit originally 🤔 (I can do so separately to make it more clear probably)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Ahh right, I confused it with the new file 🙈

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

😅 I had to double-check myself, but it was there 🤗

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/go-sdkChanges affecting the Go SDKarea/pluginsimpact/go-sdkNoteworthy (compatibility changes) in the Go SDKkind/refactorPR's that refactor, or clean-up codestatus/2-code-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@thaJeztah@codecov-commenter@vvoland