mirror of
https://github.com/docker/compose.git
synced 2025-09-22 01:07:51 +02:00
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 <github@gone.nl>
This commit is contained in:
parent
0dc9852c67
commit
909211dd61
@ -36,7 +36,7 @@ import (
|
||||
composegoutils "github.com/compose-spec/compose-go/v2/utils"
|
||||
"github.com/docker/buildx/util/logutil"
|
||||
dockercli "github.com/docker/cli/cli"
|
||||
"github.com/docker/cli/cli-plugins/manager"
|
||||
"github.com/docker/cli/cli-plugins/metadata"
|
||||
"github.com/docker/cli/cli/command"
|
||||
"github.com/docker/cli/pkg/kvfile"
|
||||
"github.com/docker/compose/v2/cmd/formatter"
|
||||
@ -416,7 +416,7 @@ const PluginName = "compose"
|
||||
|
||||
// RunningAsStandalone detects when running as a standalone program
|
||||
func RunningAsStandalone() bool {
|
||||
return len(os.Args) < 2 || os.Args[1] != manager.MetadataSubcommandName && os.Args[1] != PluginName
|
||||
return len(os.Args) < 2 || os.Args[1] != metadata.MetadataSubcommandName && os.Args[1] != PluginName
|
||||
}
|
||||
|
||||
// RootCommand returns the compose command with its child commands
|
||||
|
@ -20,7 +20,7 @@ import (
|
||||
"os"
|
||||
|
||||
dockercli "github.com/docker/cli/cli"
|
||||
"github.com/docker/cli/cli-plugins/manager"
|
||||
"github.com/docker/cli/cli-plugins/metadata"
|
||||
"github.com/docker/cli/cli-plugins/plugin"
|
||||
"github.com/docker/cli/cli/command"
|
||||
"github.com/docker/compose/v2/cmd/cmdtrace"
|
||||
@ -68,7 +68,7 @@ func pluginMain() {
|
||||
})
|
||||
return cmd
|
||||
},
|
||||
manager.Metadata{
|
||||
metadata.Metadata{
|
||||
SchemaVersion: "0.1.0",
|
||||
Vendor: "Docker Inc.",
|
||||
Version: internal.Version,
|
||||
|
@ -34,6 +34,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/compose-spec/compose-go/v2/types"
|
||||
"github.com/containerd/errdefs"
|
||||
"github.com/docker/cli/cli-plugins/manager"
|
||||
"github.com/docker/cli/cli/command"
|
||||
"github.com/docker/compose/v2/pkg/api"
|
||||
@ -75,7 +76,7 @@ func buildWithBake(dockerCli command.Cli) (bool, error) {
|
||||
|
||||
_, err = manager.GetPlugin("buildx", dockerCli, &cobra.Command{})
|
||||
if err != nil {
|
||||
if manager.IsNotFound(err) {
|
||||
if errdefs.IsNotFound(err) {
|
||||
logrus.Warnf("Docker Compose is configured to build using Bake, but buildx isn't installed")
|
||||
return false, nil
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ import (
|
||||
"sync"
|
||||
|
||||
"github.com/compose-spec/compose-go/v2/types"
|
||||
"github.com/containerd/errdefs"
|
||||
"github.com/docker/cli/cli-plugins/manager"
|
||||
"github.com/docker/cli/cli/config"
|
||||
"github.com/docker/compose/v2/pkg/progress"
|
||||
@ -163,7 +164,7 @@ func (s *composeService) getPluginBinaryPath(provider string) (path string, err
|
||||
if err == nil {
|
||||
path = plugin.Path
|
||||
}
|
||||
if manager.IsNotFound(err) {
|
||||
if errdefs.IsNotFound(err) {
|
||||
path, err = exec.LookPath(executable(provider))
|
||||
}
|
||||
return path, err
|
||||
|
@ -21,7 +21,7 @@ import (
|
||||
"os/exec"
|
||||
|
||||
"github.com/compose-spec/compose-go/v2/types"
|
||||
"github.com/docker/cli/cli-plugins/manager"
|
||||
"github.com/docker/cli/cli-plugins/metadata"
|
||||
"github.com/docker/cli/cli/context/docker"
|
||||
"github.com/docker/compose/v2/internal"
|
||||
"go.opentelemetry.io/otel"
|
||||
@ -32,7 +32,7 @@ import (
|
||||
func (s *composeService) prepareShellOut(gctx context.Context, env types.Mapping, cmd *exec.Cmd) error {
|
||||
env = env.Clone()
|
||||
// remove DOCKER_CLI_PLUGIN... variable so a docker-cli plugin will detect it run standalone
|
||||
delete(env, manager.ReexecEnvvar)
|
||||
delete(env, metadata.ReexecEnvvar)
|
||||
|
||||
// propagate opentelemetry context to child process, see https://github.com/open-telemetry/oteps/blob/main/text/0258-env-context-baggage-carriers.md
|
||||
carrier := propagation.MapCarrier{}
|
||||
@ -42,11 +42,11 @@ func (s *composeService) prepareShellOut(gctx context.Context, env types.Mapping
|
||||
env["DOCKER_CONTEXT"] = s.dockerCli.CurrentContext()
|
||||
env["USER_AGENT"] = "compose/" + internal.Version
|
||||
|
||||
metadata, err := s.dockerCli.ContextStore().GetMetadata(s.dockerCli.CurrentContext())
|
||||
md, err := s.dockerCli.ContextStore().GetMetadata(s.dockerCli.CurrentContext())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
endpoint, err := docker.EndpointFromContext(metadata)
|
||||
endpoint, err := docker.EndpointFromContext(md)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user