From f2823515db645222e6abdb31dbd711debcb37687 Mon Sep 17 00:00:00 2001 From: jaihwan104 Date: Mon, 22 Apr 2024 23:06:47 +0900 Subject: [PATCH] build: exit 1 when manifest merge failed Signed-off-by: jaihwan104 <42341126+jaihwan104@users.noreply.github.com> --- build/build.go | 5 ++++- util/progress/writer.go | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/build/build.go b/build/build.go index 895d6d2d..9854f899 100644 --- a/build/build.go +++ b/build/build.go @@ -541,7 +541,7 @@ func BuildWithResultHandler(ctx context.Context, nodes []builder.Node, opt map[s } if pushNames != "" { - progress.Write(pw, fmt.Sprintf("merging manifest list %s", pushNames), func() error { + err := progress.Write(pw, fmt.Sprintf("merging manifest list %s", pushNames), func() error { descs := make([]specs.Descriptor, 0, len(res)) for _, r := range res { @@ -637,6 +637,9 @@ func BuildWithResultHandler(ctx context.Context, nodes []builder.Node, opt map[s } return nil }) + if err != nil { + return err + } } return nil }) diff --git a/util/progress/writer.go b/util/progress/writer.go index 8e566f11..2a044e01 100644 --- a/util/progress/writer.go +++ b/util/progress/writer.go @@ -15,7 +15,7 @@ type Writer interface { ClearLogSource(interface{}) } -func Write(w Writer, name string, f func() error) { +func Write(w Writer, name string, f func() error) error { dgst := digest.FromBytes([]byte(identity.NewID())) tm := time.Now() @@ -40,6 +40,8 @@ func Write(w Writer, name string, f func() error) { w.Write(&client.SolveStatus{ Vertexes: []*client.Vertex{&vtx2}, }) + + return err } func WriteBuildRef(w Writer, target string, ref string) {