Skip to content

Commit

Permalink
Merge pull request #10881 from silvin-lubecki/display-builder-name
Browse files Browse the repository at this point in the history
Display builder's name on the first build line.
  • Loading branch information
glours authored Aug 4, 2023
2 parents c350f80 + 0a9d127 commit b406b39
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions pkg/compose/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ func (s *composeService) build(ctx context.Context, project *types.Project, opti
var (
b *builder.Builder
nodes []builder.Node
w *xprogress.Printer
)
if buildkitEnabled {
builderName := options.Builder
Expand All @@ -88,17 +89,22 @@ func (s *composeService) build(ctx context.Context, project *types.Project, opti
if err != nil {
return nil, err
}
}

// Progress needs its own context that lives longer than the
// build one otherwise it won't read all the messages from
// build and will lock
progressCtx, cancel := context.WithCancel(context.Background())
defer cancel()
// Progress needs its own context that lives longer than the
// build one otherwise it won't read all the messages from
// build and will lock
progressCtx, cancel := context.WithCancel(context.Background())
defer cancel()

w, err := xprogress.NewPrinter(progressCtx, s.stdout(), os.Stdout, options.Progress)
if err != nil {
return nil, err
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 {
return nil, err
}
}

builtDigests := make([]string, len(project.Services))
Expand Down Expand Up @@ -152,8 +158,10 @@ func (s *composeService) build(ctx context.Context, project *types.Project, opti
})

// enforce all build event get consumed
if errw := w.Wait(); errw != nil {
return nil, errw
if buildkitEnabled {
if errw := w.Wait(); errw != nil {
return nil, errw
}
}

if err != nil {
Expand Down

0 comments on commit b406b39

Please sign in to comment.