Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 8 additions & 15 deletions pkg/api/handlers/compat/images_build.go
Original file line number Diff line number Diff line change
Expand Up @@ -923,10 +923,8 @@ func handleBuildContexts(r *http.Request, query url.Values, anchorDir string, mu

logrus.Debugf("name: %q, context: %q", name, value)

switch {
case strings.HasPrefix(value, "url:"):
value = strings.TrimPrefix(value, "url:")
tempDir, subdir, err := buildahDefine.TempDirForURL(anchorDir, "buildah", value)
if urlValue, ok := strings.CutPrefix(value, "url:"); ok {
tempDir, subdir, err := buildahDefine.TempDirForURL(anchorDir, "buildah", urlValue)
if err != nil {
return nil, fmt.Errorf("downloading URL %q: %w", name, err)
}
Expand All @@ -940,15 +938,14 @@ func handleBuildContexts(r *http.Request, query url.Values, anchorDir string, mu
}

logrus.Debugf("Downloaded URL context %q to %q", name, contextPath)
case strings.HasPrefix(value, "image:"):
value = strings.TrimPrefix(value, "image:")
} else if imageValue, ok := strings.CutPrefix(value, "image:"); ok {
out.AdditionalBuildContexts[name] = &buildahDefine.AdditionalBuildContext{
IsURL: false,
IsImage: true,
Value: value,
Value: imageValue,
}

logrus.Debugf("Using image context %q: %q", name, value)
logrus.Debugf("Using image context %q: %q", name, imageValue)
}
}

Expand Down Expand Up @@ -979,8 +976,7 @@ func handleBuildContexts(r *http.Request, query url.Values, anchorDir string, mu

fieldName := part.FormName()

switch {
case fieldName == "MainContext":
if fieldName == "MainContext" {
mainDir, err := extractTarFile(anchorDir, part)
if err != nil {
return nil, fmt.Errorf("extracting main context in multipart: %w", err)
Expand All @@ -989,10 +985,7 @@ func handleBuildContexts(r *http.Request, query url.Values, anchorDir string, mu
return nil, fmt.Errorf("main context directory is empty")
}
out.ContextDirectory = mainDir

case strings.HasPrefix(fieldName, "build-context-"):
contextName := strings.TrimPrefix(fieldName, "build-context-")

} else if contextName, ok := strings.CutPrefix(fieldName, "build-context-"); ok {
// Create temp directory directly under anchorDir
additionalAnchor, err := os.MkdirTemp(anchorDir, contextName+"-*")
if err != nil {
Expand Down Expand Up @@ -1039,7 +1032,7 @@ func handleBuildContexts(r *http.Request, query url.Values, anchorDir string, mu
IsImage: false,
Value: additionalAnchor,
}
default:
} else {
logrus.Debugf("Ignoring unknown multipart field: %s", fieldName)
}
}
Expand Down
2 changes: 0 additions & 2 deletions pkg/machine/e2e/basic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ const TESTIMAGE = "quay.io/libpod/testimage:20241011"
var _ = Describe("run basic podman commands", func() {

It("Basic ops", func() {
// golangci-lint has trouble with actually skipping tests marked Skip
// so skip it on cirrus envs and where CIRRUS_CI isn't set.
name := randomString()
i := new(initMachine)
session, err := mb.setName(name).setCmd(i.withImage(mb.imagePath).withNow()).run()
Expand Down
2 changes: 1 addition & 1 deletion pkg/machine/wsl/util_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func wrapMaybe(err error, message string) error {
return errors.New(message)
}

func wrapMaybef(err error, format string, args ...interface{}) error {
func wrapMaybef(err error, format string, args ...any) error {
if err != nil {
return fmt.Errorf(format+": %w", append(args, err)...)
}
Expand Down