Merge "Fix build leak with paused jobs"

This commit is contained in:
Zuul 2019-06-26 18:39:18 +00:00 committed by Gerrit Code Review
commit 7d19df49e5
1 changed files with 10 additions and 0 deletions

View File

@ -1200,10 +1200,20 @@ class Scheduler(threading.Thread):
log = get_annotated_logger(self.log, build.zuul_event_id)
if build.build_set is not build.build_set.item.current_build_set:
log.warning("Build %s is not in the current build set", build)
try:
self.executor.cancel(build)
except Exception:
log.exception(
"Exception while canceling paused build %s", build)
return
pipeline = build.build_set.item.pipeline
if not pipeline:
log.warning("Build %s is not associated with a pipeline", build)
try:
self.executor.cancel(build)
except Exception:
log.exception(
"Exception while canceling paused build %s", build)
return
pipeline.manager.onBuildPaused(event.build)