Skip to content

Commit

Permalink
compat build: adhere to q/quiet
Browse files Browse the repository at this point in the history
Fixes: containers#12566
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
  • Loading branch information
vrothberg committed Dec 13, 2021
1 parent e993b88 commit 81a0a79
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/api/handlers/compat/images_build.go
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ func BuildImage(w http.ResponseWriter, r *http.Request) {
return
case <-runCtx.Done():
if success {
if !utils.IsLibpodRequest(r) {
if !utils.IsLibpodRequest(r) && !query.Quiet {
m.Stream = fmt.Sprintf("Successfully built %12.12s\n", imageID)
if err := enc.Encode(m); err != nil {
logrus.Warnf("Failed to json encode error %v", err)
Expand Down
8 changes: 6 additions & 2 deletions test/apiv2/10-images.at
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,16 @@ fi
curl -XPOST --data-binary @<(cat $CONTAINERFILE_TAR) \
-H "content-type: application/tar" \
--dump-header "${TMPD}/headers.txt" \
-o /dev/null \
"http://$HOST:$PORT/v1.40/libpod/build?dockerfile=containerfile" &> /dev/null
-o "${TMPD}/response.txt" \
"http://$HOST:$PORT/v1.40/build?dockerfile=containerfile&q=true" &> /dev/null
if ! grep -q '200 OK' "${TMPD}/headers.txt"; then
echo -e "${red}NOK: Image build from tar failed response was not 200 OK (application/tar)"
BUILD_TEST_ERROR="1"
fi
if grep -E "\"[0-9a-f]{64}\\\n\"" $(jq .stream "${TMPD}/response.txt"); then
echo -e "${red} quiet-mode should only send image ID"
BUILD_TEST_ERROR="1"
fi

# Yes, this is very un-RESTful re: Content-Type header ignored when compatibility endpoint used
# See https://github.com/containers/podman/issues/11012
Expand Down

0 comments on commit 81a0a79

Please sign in to comment.