From 934c40e737097c725eb42d10319f9e93f28793ef Mon Sep 17 00:00:00 2001 From: Nalin Dahyabhai Date: Fri, 27 Oct 2023 14:32:27 -0400 Subject: [PATCH] Log the platform for build errors during multi-platform builds When a multi-platform build fails and we hand an error back, add the platform to the error's context so that it's easier to tell at the end of the log which platform the build failed for. [NO NEW TESTS NEEDED] Signed-off-by: Nalin Dahyabhai --- imagebuildah/build.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/imagebuildah/build.go b/imagebuildah/build.go index 4e2d7084148..8963ce3b315 100644 --- a/imagebuildah/build.go +++ b/imagebuildah/build.go @@ -267,6 +267,9 @@ func BuildDockerfiles(ctx context.Context, store storage.Store, options define.B } thisID, thisRef, err := buildDockerfilesOnce(ctx, store, loggerPerPlatform, logPrefix, platformOptions, paths, files) if err != nil { + if errorContext := strings.TrimSpace(logPrefix); errorContext != "" { + return fmt.Errorf("%s: %w", errorContext, err) + } return err } instancesLock.Lock()