summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-02-09 14:30:12 -0500
committerGitHub <noreply@github.com>2021-02-09 14:30:12 -0500
commita8c7aedc74cf2f6d479d6dcdf87d526c4344bdd4 (patch)
tree0ffac0986ddf422b355706b23d5cde031ad5ba90
parent995a60481a873d15579739cf6f04547e3cb61a3e (diff)
parent721a1e104e388a788ab5760019fa91bcf1a5d762 (diff)
downloadpodman-a8c7aedc74cf2f6d479d6dcdf87d526c4344bdd4.tar.gz
podman-a8c7aedc74cf2f6d479d6dcdf87d526c4344bdd4.tar.bz2
podman-a8c7aedc74cf2f6d479d6dcdf87d526c4344bdd4.zip
Merge pull request #9270 from matejvasek/fix_apiv2_push
Fix Docker APIv2 push endpoint
-rw-r--r--pkg/api/handlers/compat/images_push.go11
-rw-r--r--test/apiv2/12-imagesMore.at7
2 files changed, 11 insertions, 7 deletions
diff --git a/pkg/api/handlers/compat/images_push.go b/pkg/api/handlers/compat/images_push.go
index c352ac6cd..34b53f34e 100644
--- a/pkg/api/handlers/compat/images_push.go
+++ b/pkg/api/handlers/compat/images_push.go
@@ -1,7 +1,6 @@
package compat
import (
- "context"
"net/http"
"strings"
@@ -76,7 +75,15 @@ func PushImage(w http.ResponseWriter, r *http.Request) {
if _, found := r.URL.Query()["tlsVerify"]; found {
options.SkipTLSVerify = types.NewOptionalBool(!query.TLSVerify)
}
- if err := imageEngine.Push(context.Background(), imageName, query.Destination, options); err != nil {
+
+ var destination string
+ if _, found := r.URL.Query()["destination"]; found {
+ destination = query.Destination
+ } else {
+ destination = imageName
+ }
+
+ if err := imageEngine.Push(r.Context(), imageName, destination, options); err != nil {
if errors.Cause(err) != storage.ErrImageUnknown {
utils.ImageNotFound(w, imageName, errors.Wrapf(err, "failed to find image %s", imageName))
return
diff --git a/test/apiv2/12-imagesMore.at b/test/apiv2/12-imagesMore.at
index 896e685cd..d17df79a4 100644
--- a/test/apiv2/12-imagesMore.at
+++ b/test/apiv2/12-imagesMore.at
@@ -24,13 +24,10 @@ t GET libpod/images/$IMAGE/json 200 \
# Run registry container
podman run -d --name registry -p 5000:5000 quay.io/libpod/registry:2.6 /entrypoint.sh /etc/docker/registry/config.yml
+sleep 2
# Push to local registry
-# FIXME: this is failing:
-# "cause": "received unexpected HTTP status: 500 Internal Server Error",
-# "message": "error pushing image \"localhost:5000/myrepo:mytag\": error copying image to the remote destination: Error writing blob: Error initiating layer upload to /v2/myrepo/blobs/uploads/ in localhost:5000: received unexpected HTTP status: 500 Internal Server Error",
-# "response": 400
-#t POST libpod/images/localhost:5000/myrepo:mytag/push\?tlsVerify\=false '' 200
+t POST "images/localhost:5000/myrepo/push?tlsVerify=false&tag=mytag" '' 200
# Untag the image
t POST "libpod/images/$iid/untag?repo=localhost:5000/myrepo&tag=mytag" '' 201