From 3b2aeb2d5b391f12062f4f4a3834749dd5d61a65 Mon Sep 17 00:00:00 2001 From: Tonis Tiigi Date: Fri, 18 Feb 2022 18:41:52 -0800 Subject: [PATCH] build: fix deadlock on handling deps errors Signed-off-by: Tonis Tiigi --- build/build.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/build/build.go b/build/build.go index 9dcecb58..115cefcb 100644 --- a/build/build.go +++ b/build/build.go @@ -859,15 +859,13 @@ func Build(ctx context.Context, drivers []DriverInfo, opt map[string]Options, do c := clients[dp.driverIndex] eg.Go(func() error { + pw = progress.ResetTime(pw) + defer wg.Done() + if err := waitContextDeps(ctx, dp.driverIndex, results, &so); err != nil { return err } - pw = progress.ResetTime(pw) - defer wg.Done() - ch, done := progress.NewChannel(pw) - defer func() { <-done }() - frontendInputs := make(map[string]*pb.Definition) for key, st := range so.FrontendInputs { def, err := st.Marshal(ctx) @@ -886,6 +884,9 @@ func Build(ctx context.Context, drivers []DriverInfo, opt map[string]Options, do so.FrontendAttrs = nil so.FrontendInputs = nil + ch, done := progress.NewChannel(pw) + defer func() { <-done }() + rr, err := c.Build(ctx, so, "buildx", func(ctx context.Context, c gateway.Client) (*gateway.Result, error) { res, err := c.Solve(ctx, req) if err != nil {