bake: merge cache-from field from compose and x-bake

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2022-06-23 21:47:05 +02:00
parent b438032a60
commit a0f92829a7
No known key found for this signature in database
GPG Key ID: 3248E46B6BB8C7F7
2 changed files with 2 additions and 2 deletions

View File

@ -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...)

View File

@ -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"})