Merge pull request #10881 from silvin-lubecki/display-builder-name

Display builder's name on the first build line.
This commit is contained in:
Guillaume Lours 2023-08-04 17:36:18 +02:00 committed by GitHub
commit b406b393bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 11 deletions

View File

@ -73,6 +73,7 @@ func (s *composeService) build(ctx context.Context, project *types.Project, opti
var ( var (
b *builder.Builder b *builder.Builder
nodes []builder.Node nodes []builder.Node
w *xprogress.Printer
) )
if buildkitEnabled { if buildkitEnabled {
builderName := options.Builder builderName := options.Builder
@ -88,7 +89,6 @@ func (s *composeService) build(ctx context.Context, project *types.Project, opti
if err != nil { if err != nil {
return nil, err return nil, err
} }
}
// Progress needs its own context that lives longer than the // Progress needs its own context that lives longer than the
// build one otherwise it won't read all the messages from // build one otherwise it won't read all the messages from
@ -96,10 +96,16 @@ func (s *composeService) build(ctx context.Context, project *types.Project, opti
progressCtx, cancel := context.WithCancel(context.Background()) progressCtx, cancel := context.WithCancel(context.Background())
defer cancel() defer cancel()
w, err := xprogress.NewPrinter(progressCtx, s.stdout(), os.Stdout, options.Progress) w, err = xprogress.NewPrinter(progressCtx, s.stdout(), os.Stdout, options.Progress,
xprogress.WithDesc(
fmt.Sprintf("building with %q instance using %s driver", b.Name, b.Driver),
fmt.Sprintf("%s:%s", b.Driver, b.Name),
))
if err != nil { if err != nil {
return nil, err return nil, err
} }
}
builtDigests := make([]string, len(project.Services)) builtDigests := make([]string, len(project.Services))
err = InDependencyOrder(ctx, project, func(ctx context.Context, name string) error { err = InDependencyOrder(ctx, project, func(ctx context.Context, name string) error {
@ -152,9 +158,11 @@ func (s *composeService) build(ctx context.Context, project *types.Project, opti
}) })
// enforce all build event get consumed // enforce all build event get consumed
if buildkitEnabled {
if errw := w.Wait(); errw != nil { if errw := w.Wait(); errw != nil {
return nil, errw return nil, errw
} }
}
if err != nil { if err != nil {
return nil, err return nil, err