From a0f92829a7cb21335ccb44d2dc604200a9923a5a Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Thu, 23 Jun 2022 21:47:05 +0200 Subject: [PATCH] bake: merge cache-from field from compose and x-bake Signed-off-by: CrazyMax --- bake/compose.go | 2 +- bake/compose_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bake/compose.go b/bake/compose.go index 801b2255..44bfe5dc 100644 --- a/bake/compose.go +++ b/bake/compose.go @@ -190,7 +190,7 @@ func (t *Target) composeExtTarget(exts map[string]interface{}) error { t.Tags = append(t.Tags, xb.Tags...) } if len(xb.CacheFrom) > 0 { - t.CacheFrom = xb.CacheFrom // override main field + t.CacheFrom = append(t.CacheFrom, xb.CacheFrom...) } if len(xb.CacheTo) > 0 { t.CacheTo = append(t.CacheTo, xb.CacheTo...) diff --git a/bake/compose_test.go b/bake/compose_test.go index c4e3dd1d..7ab3ad9f 100644 --- a/bake/compose_test.go +++ b/bake/compose_test.go @@ -305,7 +305,7 @@ services: require.Equal(t, c.Targets[0].Args, map[string]string{"CT_ECR": "foo", "CT_TAG": "bar"}) require.Equal(t, c.Targets[0].Tags, []string{"ct-addon:baz", "ct-addon:foo", "ct-addon:alp"}) require.Equal(t, c.Targets[0].Platforms, []string{"linux/amd64", "linux/arm64"}) - require.Equal(t, c.Targets[0].CacheFrom, []string{"type=local,src=path/to/cache"}) + require.Equal(t, c.Targets[0].CacheFrom, []string{"user/app:cache", "type=local,src=path/to/cache"}) require.Equal(t, c.Targets[0].CacheTo, []string{"user/app:cache", "type=local,dest=path/to/cache"}) require.Equal(t, c.Targets[0].Pull, newBool(true)) require.Equal(t, c.Targets[1].Tags, []string{"ct-fake-aws:bar"})