Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cli/compose/loader/interpolate.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ var interpolateTypeCastMapping = map[interp.Path]interp.Cast{
servicePath("deploy", "rollback_config", "parallelism"): toInt,
servicePath("deploy", "rollback_config", "max_failure_ratio"): toFloat,
servicePath("deploy", "restart_policy", "max_attempts"): toInt,
servicePath("deploy", "placement", "max_replicas_per_node"): toInt,
servicePath("ports", interp.PathMatchList, "target"): toInt,
servicePath("ports", interp.PathMatchList, "published"): toInt,
servicePath("ulimits", interp.PathMatchAll): toInt,
Expand Down
9 changes: 7 additions & 2 deletions cli/compose/loader/loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ volumes:

func TestLoadWithInterpolationCastFull(t *testing.T) {
dict, err := ParseYAML([]byte(`
version: "3.7"
version: "3.8"
services:
web:
configs:
Expand All @@ -604,6 +604,8 @@ services:
max_failure_ratio: $thefloat
restart_policy:
max_attempts: $theint
placement:
max_replicas_per_node: $theint
ports:
- $theint
- "34567"
Expand Down Expand Up @@ -652,7 +654,7 @@ networks:
assert.NilError(t, err)
expected := &types.Config{
Filename: "filename.yml",
Version: "3.7",
Version: "3.8",
Services: []types.ServiceConfig{
{
Name: "web",
Expand Down Expand Up @@ -685,6 +687,9 @@ networks:
RestartPolicy: &types.RestartPolicy{
MaxAttempts: uint64Ptr(555),
},
Placement: types.Placement{
MaxReplicas: 555,
},
},
Ports: []types.ServicePortConfig{
{Target: 555, Mode: "ingress", Protocol: "tcp"},
Expand Down