mirror of https://github.com/containers/podman.git
Merge pull request #23103 from Luap99/build-platform
build API: accept platform comma separated
This commit is contained in:
commit
5e27243935
|
@ -738,7 +738,12 @@ func BuildImage(w http.ResponseWriter, r *http.Request) {
|
|||
UnsetLabels: query.UnsetLabels,
|
||||
}
|
||||
|
||||
for _, platformSpec := range query.Platform {
|
||||
platforms := query.Platform
|
||||
if len(platforms) == 1 {
|
||||
// Docker API uses comma sperated platform arg so match this here
|
||||
platforms = strings.Split(query.Platform[0], ",")
|
||||
}
|
||||
for _, platformSpec := range platforms {
|
||||
os, arch, variant, err := parse.Platform(platformSpec)
|
||||
if err != nil {
|
||||
utils.BadRequest(w, "platform", platformSpec, err)
|
||||
|
|
|
@ -667,6 +667,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
|
|||
// default:
|
||||
// description: |
|
||||
// Platform format os[/arch[/variant]]
|
||||
// Can be comma separated list for multi arch builds.
|
||||
// (As of version 1.xx)
|
||||
// - in: query
|
||||
// name: target
|
||||
|
|
|
@ -274,6 +274,12 @@ else
|
|||
_show_ok 1 "compat quiet build"
|
||||
fi
|
||||
|
||||
# Do not try a real build here to tests the comma separated syntax as emulation
|
||||
# is slow and may not work everywhere, checking the error is good enough to know
|
||||
# we parsed it correctly on the server I would say
|
||||
t POST "/build?q=1&dockerfile=containerfile&platform=linux/amd64,test" $CONTAINERFILE_WITH_ERR_TAR 400 \
|
||||
.message="failed to parse query parameter 'platform': \"test\": invalid platform syntax for --platform=\"test\": \"test\": unknown operating system or architecture: invalid argument"
|
||||
|
||||
cleanBuildTest
|
||||
|
||||
# compat API vs libpod API event differences:
|
||||
|
|
Loading…
Reference in New Issue