Skip to content

Commit 02c747a

Browse files
committed
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>
1 parent 88f4f26 commit 02c747a

8 files changed

Lines changed: 18 additions & 17 deletions

File tree

cmd/compose/compose.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,17 +72,16 @@ const (
7272
)
7373

7474
// rawEnv load a dot env file using docker/cli key=value parser, without attempt to interpolate or evaluate values
75-
func rawEnv(r io.Reader, filename string, lookup func(key string) (string, bool)) (map[string]string, error) {
75+
func rawEnv(r io.Reader, filename string, vars map[string]string, lookup func(key string) (string, bool)) error {
7676
lines, err := kvfile.ParseFromReader(r, lookup)
7777
if err != nil {
78-
return nil, fmt.Errorf("failed to parse env_file %s: %w", filename, err)
78+
return fmt.Errorf("failed to parse env_file %s: %w", filename, err)
7979
}
80-
vars := types.Mapping{}
8180
for _, line := range lines {
8281
key, value, _ := strings.Cut(line, "=")
8382
vars[key] = value
8483
}
85-
return vars, nil
84+
return nil
8685
}
8786

8887
func init() {

go.mod

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ require (
88
github.com/Microsoft/go-winio v0.6.2
99
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d
1010
github.com/buger/goterm v1.0.4
11-
github.com/compose-spec/compose-go/v2 v2.4.10-0.20250327151131-f48efd965e24
11+
github.com/compose-spec/compose-go/v2 v2.5.0
1212
github.com/containerd/containerd/v2 v2.0.4
1313
github.com/containerd/platforms v1.0.0-rc.1
1414
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
@@ -205,3 +205,5 @@ require (
205205
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
206206
sigs.k8s.io/yaml v1.4.0 // indirect
207207
)
208+
209+
replace github.com/compose-spec/compose-go/v2 => github.com/glours/compose-go/v2 v2.0.0-20250403082600-80aa75f06535

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,6 @@ github.com/cloudflare/cfssl v0.0.0-20180223231731-4e2dcbde5004 h1:lkAMpLVBDaj17e
8383
github.com/cloudflare/cfssl v0.0.0-20180223231731-4e2dcbde5004/go.mod h1:yMWuSON2oQp+43nFtAV/uvKQIFpSPerB57DCt9t8sSA=
8484
github.com/codahale/rfc6979 v0.0.0-20141003034818-6a90f24967eb h1:EDmT6Q9Zs+SbUoc7Ik9EfrFqcylYqgPZ9ANSbTAntnE=
8585
github.com/codahale/rfc6979 v0.0.0-20141003034818-6a90f24967eb/go.mod h1:ZjrT6AXHbDs86ZSdt/osfBi5qfexBrKUdONk989Wnk4=
86-
github.com/compose-spec/compose-go/v2 v2.4.10-0.20250327151131-f48efd965e24 h1:dIo4KMeWqnbC/hcWm0kHf+AzEcgUdUpjO+1LEoEdhiI=
87-
github.com/compose-spec/compose-go/v2 v2.4.10-0.20250327151131-f48efd965e24/go.mod h1:vPlkN0i+0LjLf9rv52lodNMUTJF5YHVfHVGLLIP67NA=
8886
github.com/containerd/cgroups/v3 v3.0.5 h1:44na7Ud+VwyE7LIoJ8JTNQOa549a8543BmzaJHo6Bzo=
8987
github.com/containerd/cgroups/v3 v3.0.5/go.mod h1:SA5DLYnXO8pTGYiAHXz94qvLQTKfVM5GEVisn4jpins=
9088
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
169167
github.com/fvbommel/sortorder v1.1.0/go.mod h1:uk88iVf1ovNn1iLfgUVU2F9o5eO30ui720w+kxuqRs0=
170168
github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E=
171169
github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ=
170+
github.com/glours/compose-go/v2 v2.0.0-20250403082600-80aa75f06535 h1:S/P6v3QxsMpkKn+2OSMPNkfSkadSjSHoMGAc/eBZgMU=
171+
github.com/glours/compose-go/v2 v2.0.0-20250403082600-80aa75f06535/go.mod h1:vPlkN0i+0LjLf9rv52lodNMUTJF5YHVfHVGLLIP67NA=
172172
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
173173
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
174174
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=

pkg/compose/build.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ func (s *composeService) build(ctx context.Context, project *types.Project, opti
263263

264264
func (s *composeService) ensureImagesExists(ctx context.Context, project *types.Project, buildOpts *api.BuildOptions, quietPull bool) error {
265265
for name, service := range project.Services {
266-
if service.External == nil && service.Image == "" && service.Build == nil {
266+
if service.Provider == nil && service.Image == "" && service.Build == nil {
267267
return fmt.Errorf("invalid service %q. Must specify either image or build", name)
268268
}
269269
}

pkg/compose/convergence.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ func (c *convergence) apply(ctx context.Context, project *types.Project, options
110110
}
111111

112112
func (c *convergence) ensureService(ctx context.Context, project *types.Project, service types.ServiceConfig, recreate string, inherit bool, timeout *time.Duration) error { //nolint:gocyclo
113-
if service.External != nil {
113+
if service.Provider != nil {
114114
return c.service.runPlugin(ctx, project, service, "up")
115115
}
116116
expected, err := getScale(service)

pkg/compose/down.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func (s *composeService) down(ctx context.Context, projectName string, options a
8484

8585
err = InReverseDependencyOrder(ctx, project, func(c context.Context, service string) error {
8686
serv := project.Services[service]
87-
if serv.External != nil {
87+
if serv.Provider != nil {
8888
return s.runPlugin(ctx, project, serv, "down")
8989
}
9090
serviceContainers := containers.filter(isService(service))

pkg/compose/plugins.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package compose
1919
import (
2020
"context"
2121
"encoding/json"
22+
"errors"
2223
"fmt"
2324
"io"
2425
"os"
@@ -30,7 +31,6 @@ import (
3031
"github.com/docker/cli/cli-plugins/socket"
3132
"github.com/docker/compose/v2/pkg/progress"
3233
"github.com/docker/docker/errdefs"
33-
"github.com/pkg/errors"
3434
"github.com/spf13/cobra"
3535
"go.opentelemetry.io/otel"
3636
"go.opentelemetry.io/otel/propagation"
@@ -48,8 +48,8 @@ const (
4848
SetEnvType = "setenv"
4949
)
5050

51-
func (s *composeService) runPlugin(ctx context.Context, project *types.Project, service types.ServiceConfig, command string) error {
52-
x := *service.External
51+
func (s *composeService) runPlugin(ctx context.Context, project *types.Project, service types.ServiceConfig, command string) error { //nolint:gocyclo
52+
x := *service.Provider
5353

5454
// Only support Docker CLI plugins for first iteration. Could support any binary from PATH
5555
plugin, err := manager.GetPlugin(x.Type, s.dockerCli, &cobra.Command{})
@@ -97,7 +97,7 @@ func (s *composeService) runPlugin(ctx context.Context, project *types.Project,
9797
eg.Go(cmd.Wait)
9898

9999
decoder := json.NewDecoder(stdout)
100-
defer stdout.Close()
100+
defer func() { _ = stdout.Close() }()
101101

102102
variables := types.Mapping{}
103103

@@ -106,7 +106,7 @@ func (s *composeService) runPlugin(ctx context.Context, project *types.Project,
106106
for {
107107
var msg JsonMessage
108108
err = decoder.Decode(&msg)
109-
if err == io.EOF {
109+
if errors.Is(err, io.EOF) {
110110
break
111111
}
112112
if err != nil {
@@ -132,7 +132,7 @@ func (s *composeService) runPlugin(ctx context.Context, project *types.Project,
132132
err = eg.Wait()
133133
if err != nil {
134134
pw.Event(progress.ErrorMessageEvent(service.Name, err.Error()))
135-
return errors.Wrapf(err, "failed to create external service")
135+
return fmt.Errorf("failed to create external service: %s", err.Error())
136136
}
137137
pw.Event(progress.CreatedEvent(service.Name))
138138

pkg/compose/pull.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ func (s *composeService) pullRequiredImages(ctx context.Context, project *types.
335335
}
336336

337337
func mustPull(service types.ServiceConfig, images map[string]api.ImageSummary) (bool, error) {
338-
if service.External != nil {
338+
if service.Provider != nil {
339339
return false, nil
340340
}
341341
if service.Image == "" {

0 commit comments

Comments
 (0)