summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-04-07 10:03:43 -0400
committerGitHub <noreply@github.com>2021-04-07 10:03:43 -0400
commitf44645aad6822aee27c241f2f0f43bdbc652dc0a (patch)
treedc9e06d86e4fefcea8a8d3d653b9ec9a74b0232c /pkg
parent0e67053b9a26f20e5ccbffdcc5e7a84254ca16b8 (diff)
parent48b4b665b1c0c3ebab8007e0c39bb3aab6f3c414 (diff)
downloadpodman-f44645aad6822aee27c241f2f0f43bdbc652dc0a.tar.gz
podman-f44645aad6822aee27c241f2f0f43bdbc652dc0a.tar.bz2
podman-f44645aad6822aee27c241f2f0f43bdbc652dc0a.zip
Merge pull request #9962 from edsantiago/podman_remote_arch
Handle podman-remote --arch, --platform, --os
Diffstat (limited to 'pkg')
-rw-r--r--pkg/api/handlers/compat/images_build.go12
-rw-r--r--pkg/bindings/images/build.go5
2 files changed, 17 insertions, 0 deletions
diff --git a/pkg/api/handlers/compat/images_build.go b/pkg/api/handlers/compat/images_build.go
index ab92434b1..700881926 100644
--- a/pkg/api/handlers/compat/images_build.go
+++ b/pkg/api/handlers/compat/images_build.go
@@ -15,6 +15,7 @@ import (
"github.com/containers/buildah"
buildahDefine "github.com/containers/buildah/define"
+ "github.com/containers/buildah/pkg/parse"
"github.com/containers/buildah/util"
"github.com/containers/image/v5/types"
"github.com/containers/podman/v3/libpod"
@@ -445,6 +446,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)
+ if err != nil {
+ utils.BadRequest(w, "platform", query.Platform, err)
+ return
+ }
+ buildOptions.SystemContext.OSChoice = buildOptions.OS
+ buildOptions.SystemContext.ArchitectureChoice = buildOptions.Architecture
+ buildOptions.SystemContext.VariantChoice = variant
+ }
if _, found := r.URL.Query()["timestamp"]; found {
ts := time.Unix(query.Timestamp, 0)
buildOptions.Timestamp = &ts
diff --git a/pkg/bindings/images/build.go b/pkg/bindings/images/build.go
index c47a16551..34d6cee05 100644
--- a/pkg/bindings/images/build.go
+++ b/pkg/bindings/images/build.go
@@ -12,6 +12,7 @@ import (
"os"
"path/filepath"
"regexp"
+ "runtime"
"strconv"
"strings"
@@ -190,6 +191,10 @@ func Build(ctx context.Context, containerFiles []string, options entities.BuildO
platform = "linux"
}
platform += "/" + options.Architecture
+ } else {
+ if len(platform) > 0 {
+ platform += "/" + runtime.GOARCH
+ }
}
if len(platform) > 0 {
params.Set("platform", platform)