@@ -272,6 +272,8 @@ func (s *ControllerBuilderService) startBuildPayload(ctx context.Context, buildI
272272 }, nil
273273}
274274
275+ var errBuildLockConflict = errors .New ("build lock conflict" )
276+
275277func (s * ControllerBuilderService ) startBuild (ctx context.Context , conn * builderConnection , buildID string ) error {
276278 // Change build status in order to acquire lock
277279 now := time .Now ()
@@ -289,7 +291,7 @@ func (s *ControllerBuilderService) startBuild(ctx context.Context, conn *builder
289291 return err
290292 }
291293 if n == 0 {
292- return fmt . Errorf ( "failed to acquire build lock for %v, skipping" , buildID )
294+ return errBuildLockConflict
293295 }
294296
295297 // Construct payload to send to builder
@@ -366,9 +368,10 @@ func (s *ControllerBuilderService) StartBuilds(ctx context.Context, buildIDs []s
366368 err := s .startBuild (ctx , conn , buildID )
367369 if err == nil {
368370 builderIdx ++
369- } else {
371+ } else if errors . Is ( err , errBuildLockConflict ) {
370372 // It is possible that some other controller has acquired build lock first
371- // - in that case, skip and try the next build ID
373+ slog .DebugContext (ctx , "failed to acquire build lock" , "build_id" , buildID )
374+ } else {
372375 slog .ErrorContext (ctx , "error starting build" , "error" , err )
373376 }
374377 }
0 commit comments