Skip to content

Commit

Permalink
drop extends restrictions
Browse files Browse the repository at this point in the history
Signed-off-by: Nicolas De Loof <[email protected]>
  • Loading branch information
ndeloof authored and glours committed Jan 21, 2025
1 parent 84fa55e commit 1b86894
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
7 changes: 0 additions & 7 deletions loader/extends.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ import (
"github.com/compose-spec/compose-go/v2/types"
)

// as we use another service definition by `extends`, we must exclude attributes which creates dependency to another service
// see https://github.com/compose-spec/compose-spec/blob/main/05-services.md#restrictions
var exclusions = []string{"depends_on", "volumes_from"}

func ApplyExtends(ctx context.Context, dict map[string]any, opts *Options, tracker *cycleTracker, post ...PostProcessor) error {
a, ok := dict["services"]
if !ok {
Expand Down Expand Up @@ -123,9 +119,6 @@ func applyServiceExtends(ctx context.Context, name string, services map[string]a
},
})
}
for _, exclusion := range exclusions {
delete(source, exclusion)
}
merged, err := override.ExtendService(source, service)
if err != nil {
return nil, err
Expand Down
4 changes: 3 additions & 1 deletion loader/extends_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ services:
file: ./testdata/extends/depends_on.yaml
service: with_volumes_from
`,
wantErr: `service "bar" depends on undefined service "zot"`,
},
{
name: "depends_on",
Expand All @@ -333,6 +334,7 @@ services:
file: ./testdata/extends/depends_on.yaml
service: with_depends_on
`,
wantErr: `service "bar" depends on undefined service "zot"`,
},
{
name: "shared ipc",
Expand Down Expand Up @@ -397,7 +399,7 @@ services:
service_b:
extends: service_a
depends_on:
depends_on: !override
- service_a
service_c:
Expand Down

0 comments on commit 1b86894

Please sign in to comment.