Explorar o código

ci: build fix for new buildx

Signed-off-by: Milas Bowman <[email protected]>
Milas Bowman %!s(int64=2) %!d(string=hai) anos
pai
achega
061b52da9a
Modificáronse 2 ficheiros con 3 adicións e 18 borrados
  1. 2 17
      pkg/compose/build.go
  2. 1 1
      pkg/e2e/build_test.go

+ 2 - 17
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
-}

+ 1 - 1
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")`,
 		})
 	})