diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-04-15 07:18:35 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-15 07:18:35 -0400 |
commit | b2a3bb4a6180b390c87565c49798990384f16976 (patch) | |
tree | 25845cf18193a3613f623737495fa8c682786542 /pkg/api/handlers/compat/images_build.go | |
parent | df6c7c2ae5fb77a557d5616f8b422c45a43fe0ff (diff) | |
parent | 855a5a89dd24e9ef5527a34b14ef0d37cd039a26 (diff) | |
download | podman-b2a3bb4a6180b390c87565c49798990384f16976.tar.gz podman-b2a3bb4a6180b390c87565c49798990384f16976.tar.bz2 podman-b2a3bb4a6180b390c87565c49798990384f16976.zip |
Merge pull request #10034 from rhatdan/build
Fix flake on failed podman-remote build : try 2
Diffstat (limited to 'pkg/api/handlers/compat/images_build.go')
-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 e0c79e5a7..ec40fdd2d 100644 --- a/pkg/api/handlers/compat/images_build.go +++ b/pkg/api/handlers/compat/images_build.go @@ -464,15 +464,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")) } }() @@ -534,7 +535,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 { |