summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-04-14 15:34:51 -0400
committerGitHub <noreply@github.com>2021-04-14 15:34:51 -0400
commit9f36efda372bec12abb60523b787730ffb98c3a2 (patch)
treee74c7de4abbafd7f433460763dd9679f83baa0eb
parenta7bbb78c8d4b94af0d660b63bcd4573a536d969c (diff)
parent4347a62e08b2ffabd07f767bc534a8cb2f5cb0aa (diff)
downloadpodman-9f36efda372bec12abb60523b787730ffb98c3a2.tar.gz
podman-9f36efda372bec12abb60523b787730ffb98c3a2.tar.bz2
podman-9f36efda372bec12abb60523b787730ffb98c3a2.zip
Merge pull request #10030 from rhatdan/build
Fix flake on failed podman-remote build
-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 700881926..e0c79e5a7 100644
--- a/pkg/api/handlers/compat/images_build.go
+++ b/pkg/api/handlers/compat/images_build.go
@@ -462,12 +462,17 @@ func BuildImage(w http.ResponseWriter, r *http.Request) {
buildOptions.Timestamp = &ts
}
+ var (
+ imageID string
+ failed bool
+ )
+
runCtx, cancel := context.WithCancel(context.Background())
- var imageID string
go func() {
defer cancel()
imageID, _, err = runtime.Build(r.Context(), buildOptions, query.Dockerfile)
if err != nil {
+ failed = true
stderr.Write([]byte(err.Error() + "\n"))
}
}()
@@ -483,8 +488,6 @@ func BuildImage(w http.ResponseWriter, r *http.Request) {
w.Header().Add("Content-Type", "application/json")
flush()
- var failed bool
-
body := w.(io.Writer)
if logrus.IsLevelEnabled(logrus.DebugLevel) {
if v, found := os.LookupEnv("PODMAN_RETAIN_BUILD_ARTIFACT"); found {
@@ -525,7 +528,6 @@ loop:
}
flush()
case e := <-stderr.Chan():
- failed = true
m.Error = string(e)
if err := enc.Encode(m); err != nil {
logrus.Warnf("Failed to json encode error %v", err)