Skip to content

Commit

Permalink
change platform to platforms in cdflow.yaml nad release_metadata.json
Browse files Browse the repository at this point in the history
  • Loading branch information
marciogoda committed Mar 12, 2024
1 parent 4c29b6c commit f0659e0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions internal/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type config struct {
dockerfile string
context string
buildx bool
platform string
platforms string
cacheFrom string
cacheTo string
}
Expand Down Expand Up @@ -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),
"platform": config.platform})
"image": image,
"buildx": strconv.FormatBool(config.buildx),
"platforms": config.platforms})
if err != nil {
log.Fatal(err)
}
Expand Down Expand Up @@ -96,8 +96,8 @@ func buildWithBuildx(config *config, image string, runner CommandRunner) error {
runner.Run("docker", builderCreateArgs...)

buildArgs := []string{"buildx", "build", "--push"}
if config.platform != "" {
buildArgs = append(buildArgs, "--platform", config.platform)
if config.platforms != "" {
buildArgs = append(buildArgs, "--platform", config.platforms)
}

if config.cacheFrom != "" {
Expand Down Expand Up @@ -171,11 +171,11 @@ func getConfig(buildID string, params map[string]interface{}) (*config, error) {
}
}

platformI, ok := params["platform"]
platformsI, ok := params["platforms"]
if ok {
result.platform, ok = platformI.(string)
result.platforms, ok = platformsI.(string)
if !ok {
return nil, fmt.Errorf("unexpected type for build.%v.params.platform: %T (should be string)", buildID, platformI)
return nil, fmt.Errorf("unexpected type for build.%v.params.platforms: %T (should be string)", buildID, platformsI)
}
}

Expand Down
4 changes: 2 additions & 2 deletions internal/app/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ func TestBuildxRun(t *testing.T) {
commandRunner := &mockCommandRunner{}

params := map[string]interface{}{
"buildx": true,
"platform": "linux/arm64,linux/386,linux/s390x",
"buildx": true,
"platforms": "linux/arm64,linux/386,linux/s390x",
}

// When
Expand Down

0 comments on commit f0659e0

Please sign in to comment.