Skip to content

Commit 909211d

Browse files
thaJeztahglours
authored andcommitted
use cli-plugins/metadata package
The metadata types and consts where moved to a separate package, so update the code to use the new location instead of the aliases provided. Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 0dc9852 commit 909211d

File tree

5 files changed

+12
-10
lines changed

5 files changed

+12
-10
lines changed

cmd/compose/compose.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import (
3636
composegoutils "github.com/compose-spec/compose-go/v2/utils"
3737
"github.com/docker/buildx/util/logutil"
3838
dockercli "github.com/docker/cli/cli"
39-
"github.com/docker/cli/cli-plugins/manager"
39+
"github.com/docker/cli/cli-plugins/metadata"
4040
"github.com/docker/cli/cli/command"
4141
"github.com/docker/cli/pkg/kvfile"
4242
"github.com/docker/compose/v2/cmd/formatter"
@@ -416,7 +416,7 @@ const PluginName = "compose"
416416

417417
// RunningAsStandalone detects when running as a standalone program
418418
func RunningAsStandalone() bool {
419-
return len(os.Args) < 2 || os.Args[1] != manager.MetadataSubcommandName && os.Args[1] != PluginName
419+
return len(os.Args) < 2 || os.Args[1] != metadata.MetadataSubcommandName && os.Args[1] != PluginName
420420
}
421421

422422
// RootCommand returns the compose command with its child commands

cmd/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"os"
2121

2222
dockercli "github.com/docker/cli/cli"
23-
"github.com/docker/cli/cli-plugins/manager"
23+
"github.com/docker/cli/cli-plugins/metadata"
2424
"github.com/docker/cli/cli-plugins/plugin"
2525
"github.com/docker/cli/cli/command"
2626
"github.com/docker/compose/v2/cmd/cmdtrace"
@@ -68,7 +68,7 @@ func pluginMain() {
6868
})
6969
return cmd
7070
},
71-
manager.Metadata{
71+
metadata.Metadata{
7272
SchemaVersion: "0.1.0",
7373
Vendor: "Docker Inc.",
7474
Version: internal.Version,

pkg/compose/build_bake.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import (
3434
"strings"
3535

3636
"github.com/compose-spec/compose-go/v2/types"
37+
"github.com/containerd/errdefs"
3738
"github.com/docker/cli/cli-plugins/manager"
3839
"github.com/docker/cli/cli/command"
3940
"github.com/docker/compose/v2/pkg/api"
@@ -75,7 +76,7 @@ func buildWithBake(dockerCli command.Cli) (bool, error) {
7576

7677
_, err = manager.GetPlugin("buildx", dockerCli, &cobra.Command{})
7778
if err != nil {
78-
if manager.IsNotFound(err) {
79+
if errdefs.IsNotFound(err) {
7980
logrus.Warnf("Docker Compose is configured to build using Bake, but buildx isn't installed")
8081
return false, nil
8182
}

pkg/compose/plugins.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import (
3030
"sync"
3131

3232
"github.com/compose-spec/compose-go/v2/types"
33+
"github.com/containerd/errdefs"
3334
"github.com/docker/cli/cli-plugins/manager"
3435
"github.com/docker/cli/cli/config"
3536
"github.com/docker/compose/v2/pkg/progress"
@@ -163,7 +164,7 @@ func (s *composeService) getPluginBinaryPath(provider string) (path string, err
163164
if err == nil {
164165
path = plugin.Path
165166
}
166-
if manager.IsNotFound(err) {
167+
if errdefs.IsNotFound(err) {
167168
path, err = exec.LookPath(executable(provider))
168169
}
169170
return path, err

pkg/compose/shellout.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
"os/exec"
2222

2323
"github.com/compose-spec/compose-go/v2/types"
24-
"github.com/docker/cli/cli-plugins/manager"
24+
"github.com/docker/cli/cli-plugins/metadata"
2525
"github.com/docker/cli/cli/context/docker"
2626
"github.com/docker/compose/v2/internal"
2727
"go.opentelemetry.io/otel"
@@ -32,7 +32,7 @@ import (
3232
func (s *composeService) prepareShellOut(gctx context.Context, env types.Mapping, cmd *exec.Cmd) error {
3333
env = env.Clone()
3434
// remove DOCKER_CLI_PLUGIN... variable so a docker-cli plugin will detect it run standalone
35-
delete(env, manager.ReexecEnvvar)
35+
delete(env, metadata.ReexecEnvvar)
3636

3737
// propagate opentelemetry context to child process, see https://github.com/open-telemetry/oteps/blob/main/text/0258-env-context-baggage-carriers.md
3838
carrier := propagation.MapCarrier{}
@@ -42,11 +42,11 @@ func (s *composeService) prepareShellOut(gctx context.Context, env types.Mapping
4242
env["DOCKER_CONTEXT"] = s.dockerCli.CurrentContext()
4343
env["USER_AGENT"] = "compose/" + internal.Version
4444

45-
metadata, err := s.dockerCli.ContextStore().GetMetadata(s.dockerCli.CurrentContext())
45+
md, err := s.dockerCli.ContextStore().GetMetadata(s.dockerCli.CurrentContext())
4646
if err != nil {
4747
return err
4848
}
49-
endpoint, err := docker.EndpointFromContext(metadata)
49+
endpoint, err := docker.EndpointFromContext(md)
5050
if err != nil {
5151
return err
5252
}

0 commit comments

Comments
 (0)