diff --git a/README.md b/README.md index 8c52b09..fd8f6e8 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ Use buildx for image creation with multi architecture support instead of the cla Boolean parameter. Defaults to `false`. -#### platforms +#### platform Comma-separated list of platforms for the build, when buildx is enabled. E.g.: `linux/arm64,linux/386,linux/s390x`. @@ -84,7 +84,7 @@ Defaults to empty string. image: mergermarket/cdflow2-build-docker-ecr:latest params: buildx: true - platforms: linux/arm64,linux/386 + platform: linux/arm64,linux/386 cache-from: type=gha cache-to: type=gha,mode=max ``` @@ -102,7 +102,7 @@ Defaults to empty string. image: mergermarket/cdflow2-build-docker-ecr:latest params: buildx: true - platforms: linux/arm64,linux/386 + platform: linux/arm64,linux/386 cache-from: type=gha cache-to: type=gha,mode=max ``` diff --git a/internal/app/app.go b/internal/app/app.go index c14a9e3..081713d 100644 --- a/internal/app/app.go +++ b/internal/app/app.go @@ -26,7 +26,7 @@ type config struct { dockerfile string context string buildx bool - platforms string + platform string cacheFrom string cacheTo string } @@ -60,9 +60,9 @@ func Run(ecrClient ecriface.ECRAPI, runner CommandRunner, params map[string]inte } data, err := json.Marshal(map[string]string{ - "image": image, - "buildx": strconv.FormatBool(config.buildx), - "platforms": config.platforms}) + "image": image, + "buildx": strconv.FormatBool(config.buildx), + "platform": config.platform}) if err != nil { log.Fatal(err) } @@ -96,8 +96,8 @@ func buildWithBuildx(config *config, image string, runner CommandRunner) error { runner.Run("docker", builderCreateArgs...) buildArgs := []string{"buildx", "build", "--push"} - if config.platforms != "" { - buildArgs = append(buildArgs, "--platform", config.platforms) + if config.platform != "" { + buildArgs = append(buildArgs, "--platform", config.platform) } if config.cacheFrom != "" { @@ -171,11 +171,11 @@ func getConfig(buildID string, params map[string]interface{}) (*config, error) { } } - platformsI, ok := params["platforms"] + platformI, ok := params["platform"] if ok { - result.platforms, ok = platformsI.(string) + result.platform, ok = platformI.(string) if !ok { - return nil, fmt.Errorf("unexpected type for build.%v.params.platforms: %T (should be string)", buildID, platformsI) + return nil, fmt.Errorf("unexpected type for build.%v.params.platform: %T (should be string)", buildID, platformI) } } diff --git a/internal/app/app_test.go b/internal/app/app_test.go index aa1e6ab..c8bb30a 100644 --- a/internal/app/app_test.go +++ b/internal/app/app_test.go @@ -94,8 +94,8 @@ func TestBuildxRun(t *testing.T) { commandRunner := &mockCommandRunner{} params := map[string]interface{}{ - "buildx": true, - "platforms": "linux/arm64,linux/386,linux/s390x", + "buildx": true, + "platform": "linux/arm64,linux/386,linux/s390x", } // When