Explorar el Código

fail build if minimal required version of buildx isn't installed

Signed-off-by: Nicolas De Loof <[email protected]>
Nicolas De Loof hace 2 meses
padre
commit
e19e1278b5
Se han modificado 1 ficheros con 5 adiciones y 0 borrados
  1. 5 0
      pkg/compose/build_bake.go

+ 5 - 0
pkg/compose/build_bake.go

@@ -40,6 +40,7 @@ import (
 	"github.com/docker/cli/cli/command/image/build"
 	"github.com/docker/compose/v2/pkg/api"
 	"github.com/docker/compose/v2/pkg/progress"
+	"github.com/docker/docker/api/types/versions"
 	"github.com/google/uuid"
 	"github.com/moby/buildkit/client"
 	gitutil "github.com/moby/buildkit/frontend/dockerfile/dfgitutil"
@@ -308,6 +309,10 @@ func (s *composeService) doBuildBake(ctx context.Context, project *types.Project
 		return nil, err
 	}
 
+	if versions.LessThan(buildx.Version[1:], "0.17.0") {
+		return nil, fmt.Errorf("compose build requires buildx 0.17 or later")
+	}
+
 	args := []string{"bake", "--file", "-", "--progress", "rawjson", "--metadata-file", metadataFile}
 	// FIXME we should prompt user about this, but this is a breaking change in UX
 	for _, path := range read {