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