diff options
author | Nalin Dahyabhai <nalin@redhat.com> | 2021-09-14 11:52:51 -0400 |
---|---|---|
committer | Matthew Heon <mheon@redhat.com> | 2021-09-16 11:00:05 -0400 |
commit | e07dccc3ad33c9018466b40056de5f002cd11271 (patch) | |
tree | d67868d65e6924c88e45b8169fcf06f098e483a8 /pkg/api/handlers/compat | |
parent | c7c4cb886700823ba0f014e57e93faf450ac1241 (diff) | |
download | podman-e07dccc3ad33c9018466b40056de5f002cd11271.tar.gz podman-e07dccc3ad33c9018466b40056de5f002cd11271.tar.bz2 podman-e07dccc3ad33c9018466b40056de5f002cd11271.zip |
build: take advantage of --platform lists
The builder can take a list of platforms in the Platforms field of its
BuildOptions argument, and we should definitely take advantage of that.
The `bud-multiple-platform-values` test from buildah exercises support
for this, so
[NO TESTS NEEDED]
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Diffstat (limited to 'pkg/api/handlers/compat')
-rw-r--r-- | pkg/api/handlers/compat/images_build.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/pkg/api/handlers/compat/images_build.go b/pkg/api/handlers/compat/images_build.go index 6855742b2..606c52e41 100644 --- a/pkg/api/handlers/compat/images_build.go +++ b/pkg/api/handlers/compat/images_build.go @@ -106,7 +106,7 @@ func BuildImage(w http.ResponseWriter, r *http.Request) { NamespaceOptions string `schema:"nsoptions"` NoCache bool `schema:"nocache"` OutputFormat string `schema:"outputformat"` - Platform string `schema:"platform"` + Platform []string `schema:"platform"` Pull bool `schema:"pull"` PullPolicy string `schema:"pullpolicy"` Quiet bool `schema:"q"` @@ -126,7 +126,6 @@ func BuildImage(w http.ResponseWriter, r *http.Request) { Registry: "docker.io", Rm: true, ShmSize: 64 * 1024 * 1024, - Tag: []string{}, } decoder := r.Context().Value(api.DecoderKey).(*schema.Decoder) @@ -481,16 +480,17 @@ func BuildImage(w http.ResponseWriter, r *http.Request) { }, } - if len(query.Platform) > 0 { - variant := "" - buildOptions.OS, buildOptions.Architecture, variant, err = parse.Platform(query.Platform) + for _, platformSpec := range query.Platform { + os, arch, variant, err := parse.Platform(platformSpec) if err != nil { - utils.BadRequest(w, "platform", query.Platform, err) + utils.BadRequest(w, "platform", platformSpec, err) return } - buildOptions.SystemContext.OSChoice = buildOptions.OS - buildOptions.SystemContext.ArchitectureChoice = buildOptions.Architecture - buildOptions.SystemContext.VariantChoice = variant + buildOptions.Platforms = append(buildOptions.Platforms, struct{ OS, Arch, Variant string }{ + OS: os, + Arch: arch, + Variant: variant, + }) } if _, found := r.URL.Query()["timestamp"]; found { ts := time.Unix(query.Timestamp, 0) |