diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2021-04-14 15:55:09 -0400 |
---|---|---|
committer | Matthew Heon <mheon@redhat.com> | 2021-04-16 11:16:36 -0400 |
commit | fc99c7d0a3c9cfaec0658d552a5e43cda275ba55 (patch) | |
tree | b6af926acecda9e66442d32fde646daa764cbf4d /pkg/api | |
parent | 5c21861b5d964c86bc33af30e83cdcb82e198c1b (diff) | |
download | podman-fc99c7d0a3c9cfaec0658d552a5e43cda275ba55.tar.gz podman-fc99c7d0a3c9cfaec0658d552a5e43cda275ba55.tar.bz2 podman-fc99c7d0a3c9cfaec0658d552a5e43cda275ba55.zip |
Fix flake on failed podman-remote build : try 2
This time we are checking if the function actually succeeded,
otherwise we will report an error.
Also if we did not get the id, report unexpected failure.
[NO TESTS NEEDED] Still no good way to test this, but manually.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'pkg/api')
-rw-r--r-- | pkg/api/handlers/compat/images_build.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/pkg/api/handlers/compat/images_build.go b/pkg/api/handlers/compat/images_build.go index b7c5bf2d6..5b8741e89 100644 --- a/pkg/api/handlers/compat/images_build.go +++ b/pkg/api/handlers/compat/images_build.go @@ -378,15 +378,16 @@ func BuildImage(w http.ResponseWriter, r *http.Request) { var ( imageID string - failed bool + success bool ) runCtx, cancel := context.WithCancel(context.Background()) go func() { defer cancel() imageID, _, err = runtime.Build(r.Context(), buildOptions, query.Dockerfile) - if err != nil { - failed = true + if err == nil { + success = true + } else { stderr.Write([]byte(err.Error() + "\n")) } }() @@ -448,7 +449,8 @@ loop: } flush() case <-runCtx.Done(): - if !failed { + flush() + if success { if !utils.IsLibpodRequest(r) { m.Stream = fmt.Sprintf("Successfully built %12.12s\n", imageID) if err := enc.Encode(m); err != nil { |