Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change platform to platforms in cdflow.yaml nad release_metadata.json #24

Merged
merged 3 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading