diff --git a/MAINTAINERS b/MAINTAINERS index 3d3778766e2..a7810eccd79 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -23,6 +23,7 @@ people = [ "glours", + "jhrotko", "milas", "ndeloof", "nicksieger", @@ -72,6 +73,11 @@ Email = "guillaume.tardif@docker.com" GitHub = "gtardif" + [people.jhrotko] + Name = "Joana Hrotko" + Email = "joana.hrotko@docker.com" + Github = "jhrotko" + [people.laurazard] Name = "Laura Brehm" Email = "laura.brehm@docker.com" diff --git a/go.mod b/go.mod index 8a1591ffadf..5ae56d8af36 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,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.2 + github.com/compose-spec/compose-go/v2 v2.4.3 github.com/containerd/containerd v1.7.23 github.com/containerd/platforms v0.2.1 github.com/davecgh/go-spew v1.1.1 diff --git a/go.sum b/go.sum index 03d29a945c2..f7c17589163 100644 --- a/go.sum +++ b/go.sum @@ -85,8 +85,8 @@ github.com/cncf/xds/go v0.0.0-20240723142845-024c85f92f20 h1:N+3sFI5GUjRKBi+i0Tx github.com/cncf/xds/go v0.0.0-20240723142845-024c85f92f20/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8= 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.2 h1:RaZv+ZKZVNmxi4Cww1EKiJRLSZLiqVxIqhLUdH92dz4= -github.com/compose-spec/compose-go/v2 v2.4.2/go.mod h1:lFN0DrMxIncJGYAXTfWuajfwj5haBJqrBkarHcnjJKc= +github.com/compose-spec/compose-go/v2 v2.4.3 h1:4+Nd9IqIGobbPles9ZuRS5uJfFfRgBo4Wdcv+8VNex8= +github.com/compose-spec/compose-go/v2 v2.4.3/go.mod h1:lFN0DrMxIncJGYAXTfWuajfwj5haBJqrBkarHcnjJKc= github.com/containerd/cgroups v1.1.0 h1:v8rEWFl6EoqHB+swVNjVoCJE8o3jX7e8nqBGPLaDFBM= github.com/containerd/cgroups v1.1.0/go.mod h1:6ppBcbh/NOOUU+dMKrykgaBnK9lCIBxHqJDGwsa1mIw= github.com/containerd/console v1.0.4 h1:F2g4+oChYvBTsASRTz8NP6iIAi97J3TtSAsLbIFn4ro= diff --git a/internal/ocipush/push.go b/internal/ocipush/push.go index d9a7f6ec043..0296f67da46 100644 --- a/internal/ocipush/push.go +++ b/internal/ocipush/push.go @@ -178,7 +178,6 @@ func generateManifest(layers []v1.Descriptor, ociCompat api.OCIVersion) ([]Pusha case api.OCIVersion1_1: config = v1.DescriptorEmptyJSON artifactType = ComposeProjectArtifactType - config.ArtifactType = artifactType // N.B. the descriptor has the data embedded in it toPush = append(toPush, Pushable{Descriptor: config, Data: make([]byte, len(config.Data))}) default: diff --git a/pkg/compose/hash.go b/pkg/compose/hash.go index e6a189bd8db..f284a84e093 100644 --- a/pkg/compose/hash.go +++ b/pkg/compose/hash.go @@ -33,6 +33,7 @@ func ServiceHash(o types.ServiceConfig) (string, error) { o.Deploy.Replicas = nil } o.DependsOn = nil + o.Profiles = nil bytes, err := json.Marshal(o) if err != nil { diff --git a/pkg/e2e/fixtures/profiles/docker-compose.yaml b/pkg/e2e/fixtures/profiles/docker-compose.yaml new file mode 100644 index 00000000000..134d7bbc9bf --- /dev/null +++ b/pkg/e2e/fixtures/profiles/docker-compose.yaml @@ -0,0 +1,15 @@ +services: + foo: + container_name: foo_c + profiles: [ test ] + image: alpine + depends_on: [ db ] + + bar: + container_name: bar_c + profiles: [ test ] + image: alpine + + db: + container_name: db_c + image: alpine \ No newline at end of file diff --git a/pkg/e2e/up_test.go b/pkg/e2e/up_test.go index e6e138c3bce..83ce235a1d4 100644 --- a/pkg/e2e/up_test.go +++ b/pkg/e2e/up_test.go @@ -179,3 +179,16 @@ func TestUpWithAllResources(t *testing.T) { assert.Assert(t, strings.Contains(res.Combined(), fmt.Sprintf(`Volume "%s_my_vol" Created`, projectName)), res.Combined()) assert.Assert(t, strings.Contains(res.Combined(), fmt.Sprintf(`Network %s_my_net Created`, projectName)), res.Combined()) } + +func TestUpProfile(t *testing.T) { + c := NewCLI(t) + const projectName = "compose-e2e-up-profile" + t.Cleanup(func() { + c.RunDockerComposeCmd(t, "--project-name", projectName, "--profile", "test", "down", "-v") + }) + + res := c.RunDockerComposeCmd(t, "-f", "./fixtures/profiles/docker-compose.yaml", "--project-name", projectName, "up", "foo") + assert.Assert(t, strings.Contains(res.Combined(), `Container db_c Created`), res.Combined()) + assert.Assert(t, strings.Contains(res.Combined(), `Container foo_c Created`), res.Combined()) + assert.Assert(t, !strings.Contains(res.Combined(), `Container bar_c Created`), res.Combined()) +}