Skip to content

Commit

Permalink
Merge pull request #23321 from rhatdan/build
Browse files Browse the repository at this point in the history
More information for podman --remote build and running out of space.
  • Loading branch information
openshift-merge-bot[bot] authored Jul 24, 2024
2 parents 7ee2cfa + 1741901 commit 34d93d6
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions pkg/api/handlers/compat/images_build.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"path/filepath"
"strconv"
"strings"
"syscall"
"time"

"github.com/containers/buildah"
Expand All @@ -33,6 +34,13 @@ import (
"github.com/sirupsen/logrus"
)

func genSpaceErr(err error) error {
if errors.Is(err, syscall.ENOSPC) {
return fmt.Errorf("context directory may be too large: %w", err)
}
return err
}

func BuildImage(w http.ResponseWriter, r *http.Request) {
if hdr, found := r.Header["Content-Type"]; found && len(hdr) > 0 {
contentType := hdr[0]
Expand Down Expand Up @@ -73,7 +81,7 @@ func BuildImage(w http.ResponseWriter, r *http.Request) {

contextDirectory, err := extractTarFile(anchorDir, r)
if err != nil {
utils.InternalServerError(w, err)
utils.InternalServerError(w, genSpaceErr(err))
return
}

Expand Down Expand Up @@ -202,7 +210,7 @@ func BuildImage(w http.ResponseWriter, r *http.Request) {
}
tempDir, subDir, err := buildahDefine.TempDirForURL(anchorDir, "buildah", query.Remote)
if err != nil {
utils.InternalServerError(w, err)
utils.InternalServerError(w, genSpaceErr(err))
return
}
if tempDir != "" {
Expand Down

0 comments on commit 34d93d6

Please sign in to comment.