Skip to content

Commit 1b86894

Browse files
ndeloofglours
authored andcommitted
drop extends restrictions
Signed-off-by: Nicolas De Loof <[email protected]>
1 parent 84fa55e commit 1b86894

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

loader/extends.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ import (
2727
"github.com/compose-spec/compose-go/v2/types"
2828
)
2929

30-
// as we use another service definition by `extends`, we must exclude attributes which creates dependency to another service
31-
// see https://github.com/compose-spec/compose-spec/blob/main/05-services.md#restrictions
32-
var exclusions = []string{"depends_on", "volumes_from"}
33-
3430
func ApplyExtends(ctx context.Context, dict map[string]any, opts *Options, tracker *cycleTracker, post ...PostProcessor) error {
3531
a, ok := dict["services"]
3632
if !ok {
@@ -123,9 +119,6 @@ func applyServiceExtends(ctx context.Context, name string, services map[string]a
123119
},
124120
})
125121
}
126-
for _, exclusion := range exclusions {
127-
delete(source, exclusion)
128-
}
129122
merged, err := override.ExtendService(source, service)
130123
if err != nil {
131124
return nil, err

loader/extends_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@ services:
322322
file: ./testdata/extends/depends_on.yaml
323323
service: with_volumes_from
324324
`,
325+
wantErr: `service "bar" depends on undefined service "zot"`,
325326
},
326327
{
327328
name: "depends_on",
@@ -333,6 +334,7 @@ services:
333334
file: ./testdata/extends/depends_on.yaml
334335
service: with_depends_on
335336
`,
337+
wantErr: `service "bar" depends on undefined service "zot"`,
336338
},
337339
{
338340
name: "shared ipc",
@@ -397,7 +399,7 @@ services:
397399
398400
service_b:
399401
extends: service_a
400-
depends_on:
402+
depends_on: !override
401403
- service_a
402404
403405
service_c:

0 commit comments

Comments
 (0)