mirror of https://github.com/containers/podman.git
Merge pull request #21004 from umohnani8/push-endpoint
Fix push endpoint stream
This commit is contained in:
commit
b82e336751
|
@ -81,7 +81,7 @@ func PushImage(w http.ResponseWriter, r *http.Request) {
|
||||||
ForceCompressionFormat: query.ForceCompressionFormat,
|
ForceCompressionFormat: query.ForceCompressionFormat,
|
||||||
Format: query.Format,
|
Format: query.Format,
|
||||||
Password: password,
|
Password: password,
|
||||||
Quiet: true,
|
Quiet: query.Quiet,
|
||||||
RemoveSignatures: query.RemoveSignatures,
|
RemoveSignatures: query.RemoveSignatures,
|
||||||
Username: username,
|
Username: username,
|
||||||
}
|
}
|
||||||
|
@ -150,9 +150,9 @@ func PushImage(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
if pushError != nil {
|
if pushError != nil {
|
||||||
stream.Error = pushError.Error()
|
stream.Error = pushError.Error()
|
||||||
if err := enc.Encode(stream); err != nil {
|
}
|
||||||
logrus.Warnf("Failed to encode json: %v", err)
|
if err := enc.Encode(stream); err != nil {
|
||||||
}
|
logrus.Warnf("Failed to encode json: %v", err)
|
||||||
}
|
}
|
||||||
flush()
|
flush()
|
||||||
return
|
return
|
||||||
|
|
|
@ -43,8 +43,23 @@ s1=$(jq -r .status <<<"${lines[1]}")
|
||||||
like "$s1" "mytag: digest: sha256:[0-9a-f]\{64\} size: [0-9]\+" \
|
like "$s1" "mytag: digest: sha256:[0-9a-f]\{64\} size: [0-9]\+" \
|
||||||
"Push to local registry: second status line"
|
"Push to local registry: second status line"
|
||||||
|
|
||||||
|
# Push to local registry using the libpod endpoint with quiet=false...
|
||||||
|
# First create a new tag for the image to push
|
||||||
|
t POST "libpod/images/$IMAGE/tag?repo=localhost:$REGISTRY_PORT/myrepo&tag=quiet-false" 201
|
||||||
|
|
||||||
|
t POST "libpod/images/localhost:$REGISTRY_PORT/myrepo:quiet-false/push?tlsVerify=false&quiet=false" 200
|
||||||
|
|
||||||
|
# ...and check output. We can't use our built-in checks because this output
|
||||||
|
# is a sequence of JSON objects, i.e., individual ones, not in a JSON array.
|
||||||
|
# The lines themselves are valid JSON, but taken together they are not.
|
||||||
|
readarray lines <<<"$output"
|
||||||
|
s0=$(jq -r .manifestdigest <<<"${lines[-1]}")
|
||||||
|
like "$s0" "sha256:[0-9a-f]\{64\}" \
|
||||||
|
"Push to local registry: last line in push report"
|
||||||
|
|
||||||
# Untag the image
|
# Untag the image
|
||||||
t POST "libpod/images/$iid/untag?repo=localhost:$REGISTRY_PORT/myrepo&tag=mytag" 201
|
t POST "libpod/images/$iid/untag?repo=localhost:$REGISTRY_PORT/myrepo&tag=mytag" 201
|
||||||
|
t POST "libpod/images/$iid/untag?repo=localhost:$REGISTRY_PORT/myrepo&tag=quiet-false" 201
|
||||||
|
|
||||||
# Try to push non-existing image
|
# Try to push non-existing image
|
||||||
t POST "images/localhost:$REGISTRY_PORT/idonotexist/push?tlsVerify=false" 404
|
t POST "images/localhost:$REGISTRY_PORT/idonotexist/push?tlsVerify=false" 404
|
||||||
|
|
Loading…
Reference in New Issue