From 344adac7a64e15c9563f79c38495c2895e02c0b4 Mon Sep 17 00:00:00 2001 From: Silvin Lubecki Date: Wed, 26 Jun 2019 15:22:08 +0200 Subject: [PATCH] Rollback config type interpolation on fields "parallelism" and "max_failure_ratio" were missing, as it uses the same type as update_config. Signed-off-by: Silvin Lubecki (cherry picked from commit efdf36fa81b7d737a3afba21e309fd755f80b264) Signed-off-by: Sebastiaan van Stijn --- cli/compose/loader/interpolate.go | 2 ++ cli/compose/loader/loader_test.go | 11 +++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/cli/compose/loader/interpolate.go b/cli/compose/loader/interpolate.go index 888d29b58c..f0a321fc49 100644 --- a/cli/compose/loader/interpolate.go +++ b/cli/compose/loader/interpolate.go @@ -16,6 +16,8 @@ var interpolateTypeCastMapping = map[interp.Path]interp.Cast{ servicePath("deploy", "replicas"): toInt, servicePath("deploy", "update_config", "parallelism"): toInt, servicePath("deploy", "update_config", "max_failure_ratio"): toFloat, + servicePath("deploy", "rollback_config", "parallelism"): toInt, + servicePath("deploy", "rollback_config", "max_failure_ratio"): toFloat, servicePath("deploy", "restart_policy", "max_attempts"): toInt, servicePath("ports", interp.PathMatchList, "target"): toInt, servicePath("ports", interp.PathMatchList, "published"): toInt, diff --git a/cli/compose/loader/loader_test.go b/cli/compose/loader/loader_test.go index a5933cc31c..381dec252d 100644 --- a/cli/compose/loader/loader_test.go +++ b/cli/compose/loader/loader_test.go @@ -582,7 +582,7 @@ volumes: func TestLoadWithInterpolationCastFull(t *testing.T) { dict, err := ParseYAML([]byte(` -version: "3.4" +version: "3.7" services: web: configs: @@ -599,6 +599,9 @@ services: update_config: parallelism: $theint max_failure_ratio: $thefloat + rollback_config: + parallelism: $theint + max_failure_ratio: $thefloat restart_policy: max_attempts: $theint ports: @@ -649,7 +652,7 @@ networks: assert.NilError(t, err) expected := &types.Config{ Filename: "filename.yml", - Version: "3.4", + Version: "3.7", Services: []types.ServiceConfig{ { Name: "web", @@ -675,6 +678,10 @@ networks: Parallelism: uint64Ptr(555), MaxFailureRatio: 3.14, }, + RollbackConfig: &types.UpdateConfig{ + Parallelism: uint64Ptr(555), + MaxFailureRatio: 3.14, + }, RestartPolicy: &types.RestartPolicy{ MaxAttempts: uint64Ptr(555), },