Skip to content

Commit 0a9d127

Browse files
Display builder's name on the first build line.
Code borrowed from buildx commands/build.go. Signed-off-by: Silvin Lubecki <[email protected]>
1 parent c350f80 commit 0a9d127

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

pkg/compose/build.go

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ func (s *composeService) build(ctx context.Context, project *types.Project, opti
7373
var (
7474
b *builder.Builder
7575
nodes []builder.Node
76+
w *xprogress.Printer
7677
)
7778
if buildkitEnabled {
7879
builderName := options.Builder
@@ -88,17 +89,22 @@ func (s *composeService) build(ctx context.Context, project *types.Project, opti
8889
if err != nil {
8990
return nil, err
9091
}
91-
}
9292

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

99-
w, err := xprogress.NewPrinter(progressCtx, s.stdout(), os.Stdout, options.Progress)
100-
if err != nil {
101-
return nil, err
99+
w, err = xprogress.NewPrinter(progressCtx, s.stdout(), os.Stdout, options.Progress,
100+
xprogress.WithDesc(
101+
fmt.Sprintf("building with %q instance using %s driver", b.Name, b.Driver),
102+
fmt.Sprintf("%s:%s", b.Driver, b.Name),
103+
))
104+
105+
if err != nil {
106+
return nil, err
107+
}
102108
}
103109

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

154160
// enforce all build event get consumed
155-
if errw := w.Wait(); errw != nil {
156-
return nil, errw
161+
if buildkitEnabled {
162+
if errw := w.Wait(); errw != nil {
163+
return nil, errw
164+
}
157165
}
158166

159167
if err != nil {

0 commit comments

Comments
 (0)