summaryrefslogtreecommitdiff
path: root/pkg/api/handlers
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2021-04-14 15:55:09 -0400
committerDaniel J Walsh <dwalsh@redhat.com>2021-04-14 16:51:13 -0400
commit855a5a89dd24e9ef5527a34b14ef0d37cd039a26 (patch)
tree86b4870d4c4967b4dfbb3329e1b09fedae257e14 /pkg/api/handlers
parent9f36efda372bec12abb60523b787730ffb98c3a2 (diff)
downloadpodman-855a5a89dd24e9ef5527a34b14ef0d37cd039a26.tar.gz
podman-855a5a89dd24e9ef5527a34b14ef0d37cd039a26.tar.bz2
podman-855a5a89dd24e9ef5527a34b14ef0d37cd039a26.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/handlers')
-rw-r--r--pkg/api/handlers/compat/images_build.go10
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 {