@@ -176,12 +176,16 @@ func (s *composeService) doBuildBake(ctx context.Context, project *types.Project
176176 privileged = true
177177 }
178178
179- var output string
179+ var outputs []string
180+ var call string
180181 push := options .Push && service .Image != ""
181- if len (service .Build .Platforms ) > 1 {
182- output = fmt .Sprintf ("type=image,push=%t" , push )
183- } else {
184- output = fmt .Sprintf ("type=docker,load=true,push=%t" , push )
182+ switch {
183+ case options .Check :
184+ call = "lint"
185+ case len (service .Build .Platforms ) > 1 :
186+ outputs = []string {fmt .Sprintf ("type=image,push=%t" , push )}
187+ default :
188+ outputs = []string {fmt .Sprintf ("type=docker,load=true,push=%t" , push )}
185189 }
186190
187191 read = append (read , build .Context )
@@ -212,7 +216,9 @@ func (s *composeService) doBuildBake(ctx context.Context, project *types.Project
212216 ShmSize : build .ShmSize ,
213217 Ulimits : toBakeUlimits (build .Ulimits ),
214218 Entitlements : entitlements ,
215- Outputs : []string {output },
219+
220+ Outputs : outputs ,
221+ Call : call ,
216222 }
217223 group .Targets = append (group .Targets , serviceName )
218224 }
@@ -284,7 +290,7 @@ func (s *composeService) doBuildBake(ctx context.Context, project *types.Project
284290 return nil , err
285291 }
286292
287- var errMessage string
293+ var errMessage [] string
288294 scanner := bufio .NewScanner (pipe )
289295 scanner .Split (bufio .ScanLines )
290296
@@ -300,7 +306,9 @@ func (s *composeService) doBuildBake(ctx context.Context, project *types.Project
300306 err := decoder .Decode (& status )
301307 if err != nil {
302308 if strings .HasPrefix (line , "ERROR: " ) {
303- errMessage = line [7 :]
309+ errMessage = append (errMessage , line [7 :])
310+ } else {
311+ errMessage = append (errMessage , line )
304312 }
305313 continue
306314 }
@@ -310,8 +318,8 @@ func (s *composeService) doBuildBake(ctx context.Context, project *types.Project
310318
311319 err = eg .Wait ()
312320 if err != nil {
313- if errMessage != "" {
314- return nil , errors .New (errMessage )
321+ if len ( errMessage ) > 0 {
322+ return nil , errors .New (strings . Join ( errMessage , " \n " ) )
315323 }
316324 return nil , fmt .Errorf ("failed to execute bake: %w" , err )
317325 }
0 commit comments