From a351585024af66ed4bd47795cddd84e28bf596ac Mon Sep 17 00:00:00 2001 From: Nicolas De Loof Date: Wed, 8 Jan 2025 15:55:05 +0100 Subject: [PATCH] can't render progress concurrently with buildkit Signed-off-by: Nicolas De Loof --- pkg/compose/build.go | 6 +++--- pkg/progress/tty.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/compose/build.go b/pkg/compose/build.go index 6a47a5cf1..16390169b 100644 --- a/pkg/compose/build.go +++ b/pkg/compose/build.go @@ -150,12 +150,13 @@ func (s *composeService) build(ctx context.Context, project *types.Project, opti } return -1 } + + cw := progress.ContextWriter(ctx) err = InDependencyOrder(ctx, project, func(ctx context.Context, name string) error { service, ok := serviceToBuild[name] if !ok { return nil } - cw := progress.ContextWriter(ctx) serviceName := fmt.Sprintf("Service %s", name) if !buildkitEnabled { @@ -182,12 +183,10 @@ func (s *composeService) build(ctx context.Context, project *types.Project, opti return err } - cw.Event(progress.BuildingEvent(serviceName)) digest, err := s.doBuildBuildkit(ctx, name, buildOptions, w, nodes) if err != nil { return err } - cw.Event(progress.BuiltEvent(serviceName)) builtDigests[getServiceIndex(name)] = digest return nil @@ -211,6 +210,7 @@ func (s *composeService) build(ctx context.Context, project *types.Project, opti service := project.Services[names[i]] imageRef := api.GetImageNameOrDefault(service, project.Name) imageIDs[imageRef] = imageDigest + cw.Event(progress.BuiltEvent(names[i])) } } return imageIDs, err diff --git a/pkg/progress/tty.go b/pkg/progress/tty.go index aa345ab53..7c65ad6d3 100644 --- a/pkg/progress/tty.go +++ b/pkg/progress/tty.go @@ -167,7 +167,7 @@ func (w *ttyWriter) print() { //nolint:gocyclo _, _ = fmt.Fprint(w.out, aec.Show) }() - firstLine := fmt.Sprintf("[+] %s %d/%d", w.progressTitle, numDone(w.events), w.numLines) + firstLine := fmt.Sprintf("[+] %s %d/%d", w.progressTitle, numDone(w.events), len(w.events)) if w.numLines != 0 && numDone(w.events) == w.numLines { firstLine = DoneColor(firstLine) }