aboutsummaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
Diffstat (limited to 'pkg')
-rw-r--r--pkg/api/Makefile3
-rw-r--r--pkg/api/handlers/compat/images_build.go12
-rw-r--r--pkg/api/handlers/compat/volumes.go2
-rw-r--r--pkg/api/handlers/libpod/swagger.go2
-rw-r--r--pkg/api/handlers/libpod/volumes.go2
-rw-r--r--pkg/api/server/register_containers.go13
-rw-r--r--pkg/api/server/register_manifest.go1
-rw-r--r--pkg/bindings/images/build.go5
-rw-r--r--pkg/domain/filters/volumes.go20
9 files changed, 55 insertions, 5 deletions
diff --git a/pkg/api/Makefile b/pkg/api/Makefile
index 6b24bfd83..6da5fb57e 100644
--- a/pkg/api/Makefile
+++ b/pkg/api/Makefile
@@ -5,6 +5,9 @@ SWAGGER_OUT ?= swagger.yaml
validate: ${SWAGGER_OUT}
swagger validate ${SWAGGER_OUT}
+serve: ${SWAGGER_OUT}
+ swagger serve -F redoc -p=8080 swagger.yaml
+
.PHONY: ${SWAGGER_OUT}
${SWAGGER_OUT}:
# generate doesn't remove file on error
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/api/handlers/compat/volumes.go b/pkg/api/handlers/compat/volumes.go
index 42ece643b..d86fc1e19 100644
--- a/pkg/api/handlers/compat/volumes.go
+++ b/pkg/api/handlers/compat/volumes.go
@@ -266,7 +266,7 @@ func PruneVolumes(w http.ResponseWriter, r *http.Request) {
}
f := (url.Values)(*filterMap)
- filterFuncs, err := filters.GenerateVolumeFilters(f)
+ filterFuncs, err := filters.GeneratePruneVolumeFilters(f)
if err != nil {
utils.Error(w, "Something when wrong.", http.StatusInternalServerError, errors.Wrapf(err, "failed to parse filters for %s", f.Encode()))
return
diff --git a/pkg/api/handlers/libpod/swagger.go b/pkg/api/handlers/libpod/swagger.go
index 2631f19ac..9450a70d9 100644
--- a/pkg/api/handlers/libpod/swagger.go
+++ b/pkg/api/handlers/libpod/swagger.go
@@ -25,7 +25,7 @@ type swagInspectPodResponse struct {
// swagger:response InspectManifest
type swagInspectManifestResponse struct {
// in:body
- Body manifest.List
+ Body manifest.Schema2List
}
// Kill Pod
diff --git a/pkg/api/handlers/libpod/volumes.go b/pkg/api/handlers/libpod/volumes.go
index 442b53d1e..68aec30d5 100644
--- a/pkg/api/handlers/libpod/volumes.go
+++ b/pkg/api/handlers/libpod/volumes.go
@@ -150,7 +150,7 @@ func pruneVolumesHelper(r *http.Request) ([]*reports.PruneReport, error) {
}
f := (url.Values)(*filterMap)
- filterFuncs, err := filters.GenerateVolumeFilters(f)
+ filterFuncs, err := filters.GeneratePruneVolumeFilters(f)
if err != nil {
return nil, err
}
diff --git a/pkg/api/server/register_containers.go b/pkg/api/server/register_containers.go
index c2bb44c8f..536c4707a 100644
--- a/pkg/api/server/register_containers.go
+++ b/pkg/api/server/register_containers.go
@@ -1194,11 +1194,22 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error {
// - removing
// - stopping
// description: "Conditions to wait for. If no condition provided the 'exited' condition is assumed."
+ // - in: query
+ // name: interval
+ // type: string
+ // default: "250ms"
+ // description: Time Interval to wait before polling for completion.
// produces:
// - application/json
+ // - text/plain
// responses:
// 200:
- // $ref: "#/responses/ContainerWaitResponse"
+ // description: Status code
+ // schema:
+ // type: integer
+ // format: int32
+ // examples:
+ // text/plain: 137
// 404:
// $ref: "#/responses/NoSuchContainer"
// 500:
diff --git a/pkg/api/server/register_manifest.go b/pkg/api/server/register_manifest.go
index 230704b1f..010d8a79e 100644
--- a/pkg/api/server/register_manifest.go
+++ b/pkg/api/server/register_manifest.go
@@ -81,6 +81,7 @@ func (s *APIServer) registerManifestHandlers(r *mux.Router) error {
r.Handle(VersionedPath("/libpod/manifests/{name:.*}/json"), s.APIHandler(libpod.ManifestInspect)).Methods(http.MethodGet)
// swagger:operation POST /libpod/manifests/{name}/add manifests ManifestAddLibpod
// ---
+ // summary: Add image
// description: Add an image to a manifest list
// produces:
// - application/json
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)
diff --git a/pkg/domain/filters/volumes.go b/pkg/domain/filters/volumes.go
index 9b2fc5280..9a08adf82 100644
--- a/pkg/domain/filters/volumes.go
+++ b/pkg/domain/filters/volumes.go
@@ -75,7 +75,25 @@ func GenerateVolumeFilters(filters url.Values) ([]libpod.VolumeFilter, error) {
return dangling
})
default:
- return nil, errors.Errorf("%q is in an invalid volume filter", filter)
+ return nil, errors.Errorf("%q is an invalid volume filter", filter)
+ }
+ }
+ }
+ return vf, nil
+}
+
+func GeneratePruneVolumeFilters(filters url.Values) ([]libpod.VolumeFilter, error) {
+ var vf []libpod.VolumeFilter
+ for filter, v := range filters {
+ for _, val := range v {
+ switch filter {
+ case "label":
+ filter := val
+ vf = append(vf, func(v *libpod.Volume) bool {
+ return util.MatchLabelFilters([]string{filter}, v.Labels())
+ })
+ default:
+ return nil, errors.Errorf("%q is an invalid volume filter", filter)
}
}
}