can't render progress concurrently with buildkit

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
Nicolas De Loof 2025-01-08 15:55:05 +01:00 committed by Nicolas De loof
parent b6db1380ec
commit a351585024
2 changed files with 4 additions and 4 deletions

View File

@ -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

View File

@ -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)
}