mirror of
https://github.com/docker/compose.git
synced 2025-04-08 17:05:13 +02:00
bump compose-go to custom version of v2.5.0
should be replace by v2.5.1 it will be released Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
This commit is contained in:
parent
88f4f265db
commit
02c747a7de
@ -72,17 +72,16 @@ const (
|
||||
)
|
||||
|
||||
// rawEnv load a dot env file using docker/cli key=value parser, without attempt to interpolate or evaluate values
|
||||
func rawEnv(r io.Reader, filename string, lookup func(key string) (string, bool)) (map[string]string, error) {
|
||||
func rawEnv(r io.Reader, filename string, vars map[string]string, lookup func(key string) (string, bool)) error {
|
||||
lines, err := kvfile.ParseFromReader(r, lookup)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to parse env_file %s: %w", filename, err)
|
||||
return fmt.Errorf("failed to parse env_file %s: %w", filename, err)
|
||||
}
|
||||
vars := types.Mapping{}
|
||||
for _, line := range lines {
|
||||
key, value, _ := strings.Cut(line, "=")
|
||||
vars[key] = value
|
||||
}
|
||||
return vars, nil
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
4
go.mod
4
go.mod
@ -8,7 +8,7 @@ require (
|
||||
github.com/Microsoft/go-winio v0.6.2
|
||||
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d
|
||||
github.com/buger/goterm v1.0.4
|
||||
github.com/compose-spec/compose-go/v2 v2.4.10-0.20250327151131-f48efd965e24
|
||||
github.com/compose-spec/compose-go/v2 v2.5.0
|
||||
github.com/containerd/containerd/v2 v2.0.4
|
||||
github.com/containerd/platforms v1.0.0-rc.1
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
|
||||
@ -205,3 +205,5 @@ require (
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
|
||||
sigs.k8s.io/yaml v1.4.0 // indirect
|
||||
)
|
||||
|
||||
replace github.com/compose-spec/compose-go/v2 => github.com/glours/compose-go/v2 v2.0.0-20250403082600-80aa75f06535
|
||||
|
4
go.sum
4
go.sum
@ -83,8 +83,6 @@ github.com/cloudflare/cfssl v0.0.0-20180223231731-4e2dcbde5004 h1:lkAMpLVBDaj17e
|
||||
github.com/cloudflare/cfssl v0.0.0-20180223231731-4e2dcbde5004/go.mod h1:yMWuSON2oQp+43nFtAV/uvKQIFpSPerB57DCt9t8sSA=
|
||||
github.com/codahale/rfc6979 v0.0.0-20141003034818-6a90f24967eb h1:EDmT6Q9Zs+SbUoc7Ik9EfrFqcylYqgPZ9ANSbTAntnE=
|
||||
github.com/codahale/rfc6979 v0.0.0-20141003034818-6a90f24967eb/go.mod h1:ZjrT6AXHbDs86ZSdt/osfBi5qfexBrKUdONk989Wnk4=
|
||||
github.com/compose-spec/compose-go/v2 v2.4.10-0.20250327151131-f48efd965e24 h1:dIo4KMeWqnbC/hcWm0kHf+AzEcgUdUpjO+1LEoEdhiI=
|
||||
github.com/compose-spec/compose-go/v2 v2.4.10-0.20250327151131-f48efd965e24/go.mod h1:vPlkN0i+0LjLf9rv52lodNMUTJF5YHVfHVGLLIP67NA=
|
||||
github.com/containerd/cgroups/v3 v3.0.5 h1:44na7Ud+VwyE7LIoJ8JTNQOa549a8543BmzaJHo6Bzo=
|
||||
github.com/containerd/cgroups/v3 v3.0.5/go.mod h1:SA5DLYnXO8pTGYiAHXz94qvLQTKfVM5GEVisn4jpins=
|
||||
github.com/containerd/console v1.0.4 h1:F2g4+oChYvBTsASRTz8NP6iIAi97J3TtSAsLbIFn4ro=
|
||||
@ -169,6 +167,8 @@ github.com/fvbommel/sortorder v1.1.0 h1:fUmoe+HLsBTctBDoaBwpQo5N+nrCp8g/BjKb/6ZQ
|
||||
github.com/fvbommel/sortorder v1.1.0/go.mod h1:uk88iVf1ovNn1iLfgUVU2F9o5eO30ui720w+kxuqRs0=
|
||||
github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E=
|
||||
github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ=
|
||||
github.com/glours/compose-go/v2 v2.0.0-20250403082600-80aa75f06535 h1:S/P6v3QxsMpkKn+2OSMPNkfSkadSjSHoMGAc/eBZgMU=
|
||||
github.com/glours/compose-go/v2 v2.0.0-20250403082600-80aa75f06535/go.mod h1:vPlkN0i+0LjLf9rv52lodNMUTJF5YHVfHVGLLIP67NA=
|
||||
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
|
||||
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
|
||||
|
@ -263,7 +263,7 @@ func (s *composeService) build(ctx context.Context, project *types.Project, opti
|
||||
|
||||
func (s *composeService) ensureImagesExists(ctx context.Context, project *types.Project, buildOpts *api.BuildOptions, quietPull bool) error {
|
||||
for name, service := range project.Services {
|
||||
if service.External == nil && service.Image == "" && service.Build == nil {
|
||||
if service.Provider == nil && service.Image == "" && service.Build == nil {
|
||||
return fmt.Errorf("invalid service %q. Must specify either image or build", name)
|
||||
}
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ func (c *convergence) apply(ctx context.Context, project *types.Project, options
|
||||
}
|
||||
|
||||
func (c *convergence) ensureService(ctx context.Context, project *types.Project, service types.ServiceConfig, recreate string, inherit bool, timeout *time.Duration) error { //nolint:gocyclo
|
||||
if service.External != nil {
|
||||
if service.Provider != nil {
|
||||
return c.service.runPlugin(ctx, project, service, "up")
|
||||
}
|
||||
expected, err := getScale(service)
|
||||
|
@ -84,7 +84,7 @@ func (s *composeService) down(ctx context.Context, projectName string, options a
|
||||
|
||||
err = InReverseDependencyOrder(ctx, project, func(c context.Context, service string) error {
|
||||
serv := project.Services[service]
|
||||
if serv.External != nil {
|
||||
if serv.Provider != nil {
|
||||
return s.runPlugin(ctx, project, serv, "down")
|
||||
}
|
||||
serviceContainers := containers.filter(isService(service))
|
||||
|
@ -19,6 +19,7 @@ package compose
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
@ -30,7 +31,6 @@ import (
|
||||
"github.com/docker/cli/cli-plugins/socket"
|
||||
"github.com/docker/compose/v2/pkg/progress"
|
||||
"github.com/docker/docker/errdefs"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spf13/cobra"
|
||||
"go.opentelemetry.io/otel"
|
||||
"go.opentelemetry.io/otel/propagation"
|
||||
@ -48,8 +48,8 @@ const (
|
||||
SetEnvType = "setenv"
|
||||
)
|
||||
|
||||
func (s *composeService) runPlugin(ctx context.Context, project *types.Project, service types.ServiceConfig, command string) error {
|
||||
x := *service.External
|
||||
func (s *composeService) runPlugin(ctx context.Context, project *types.Project, service types.ServiceConfig, command string) error { //nolint:gocyclo
|
||||
x := *service.Provider
|
||||
|
||||
// Only support Docker CLI plugins for first iteration. Could support any binary from PATH
|
||||
plugin, err := manager.GetPlugin(x.Type, s.dockerCli, &cobra.Command{})
|
||||
@ -97,7 +97,7 @@ func (s *composeService) runPlugin(ctx context.Context, project *types.Project,
|
||||
eg.Go(cmd.Wait)
|
||||
|
||||
decoder := json.NewDecoder(stdout)
|
||||
defer stdout.Close()
|
||||
defer func() { _ = stdout.Close() }()
|
||||
|
||||
variables := types.Mapping{}
|
||||
|
||||
@ -106,7 +106,7 @@ func (s *composeService) runPlugin(ctx context.Context, project *types.Project,
|
||||
for {
|
||||
var msg JsonMessage
|
||||
err = decoder.Decode(&msg)
|
||||
if err == io.EOF {
|
||||
if errors.Is(err, io.EOF) {
|
||||
break
|
||||
}
|
||||
if err != nil {
|
||||
@ -132,7 +132,7 @@ func (s *composeService) runPlugin(ctx context.Context, project *types.Project,
|
||||
err = eg.Wait()
|
||||
if err != nil {
|
||||
pw.Event(progress.ErrorMessageEvent(service.Name, err.Error()))
|
||||
return errors.Wrapf(err, "failed to create external service")
|
||||
return fmt.Errorf("failed to create external service: %s", err.Error())
|
||||
}
|
||||
pw.Event(progress.CreatedEvent(service.Name))
|
||||
|
||||
|
@ -335,7 +335,7 @@ func (s *composeService) pullRequiredImages(ctx context.Context, project *types.
|
||||
}
|
||||
|
||||
func mustPull(service types.ServiceConfig, images map[string]api.ImageSummary) (bool, error) {
|
||||
if service.External != nil {
|
||||
if service.Provider != nil {
|
||||
return false, nil
|
||||
}
|
||||
if service.Image == "" {
|
||||
|
Loading…
x
Reference in New Issue
Block a user