From 061b52da9aff50a200865bdc8cb545eb73bf03f8 Mon Sep 17 00:00:00 2001 From: Milas Bowman Date: Tue, 20 Jun 2023 15:53:59 -0400 Subject: [PATCH] ci: build fix for new buildx Signed-off-by: Milas Bowman --- pkg/compose/build.go | 19 ++----------------- pkg/e2e/build_test.go | 2 +- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/pkg/compose/build.go b/pkg/compose/build.go index 59dba077d..896eefe7d 100644 --- a/pkg/compose/build.go +++ b/pkg/compose/build.go @@ -368,8 +368,8 @@ func (s *composeService) toBuildOptions(project *types.Project, service types.Se DockerfilePath: dockerFilePath(service.Build.Context, service.Build.Dockerfile), NamedContexts: toBuildContexts(service.Build.AdditionalContexts), }, - CacheFrom: convertCacheOptions(cacheFrom), - CacheTo: convertCacheOptions(cacheTo), + CacheFrom: pb.CreateCaches(cacheFrom), + CacheTo: pb.CreateCaches(cacheTo), NoCache: service.Build.NoCache, Pull: service.Build.Pull, BuildArgs: buildArgs, @@ -537,18 +537,3 @@ func useDockerDefaultOrServicePlatform(project *types.Project, service types.Ser } return plats, nil } - -func convertCacheOptions(in []*pb.CacheOptionsEntry) []bclient.CacheOptionsEntry { - out := make([]bclient.CacheOptionsEntry, len(in)) - for i := range in { - attrs := make(map[string]string, len(in[i].Attrs)) - for k, v := range in[i].Attrs { - attrs[k] = v - } - out[i] = bclient.CacheOptionsEntry{ - Type: in[i].Type, - Attrs: attrs, - } - } - return out -} diff --git a/pkg/e2e/build_test.go b/pkg/e2e/build_test.go index 3d1315e27..3af4347db 100644 --- a/pkg/e2e/build_test.go +++ b/pkg/e2e/build_test.go @@ -386,7 +386,7 @@ func TestBuildPlatformsStandardErrors(t *testing.T) { res := c.RunDockerComposeCmdNoCheck(t, "--project-directory", "fixtures/build-test/platforms", "build") res.Assert(t, icmd.Expected{ ExitCode: 17, - Err: `multiple platforms feature is currently not supported for docker driver. Please switch to a different driver (eg. "docker buildx create --use")`, + Err: `Multiple platforms feature is currently not supported for docker driver. Please switch to a different driver (eg. "docker buildx create --use")`, }) })