Repository navigation
Allow pending builds in paused pipelines to be aborted and automatically abort pending builds in archived pipelines - #9521
Merged
Merged
Conversation
This bug was introduced in v6.0.0 when big changes were made to the scheduler and related db components. It was made by a change to the JobFactory query that fetches jobs that need scheduling. The query would filter out jobs and pipelines that were paused, making it impossible for us to abort any builds that were part of paused jobs or pipelines. Changing this query alone fixes the bug without any weird scheduling regressions. The rest of the changes are to ensure we don't consume any more resources than we need to, ensuring performance doesn't degrade since we'll definitely fetch more builds now. First, I had to update db.Job to include info about its pipeline being paused or not. That leverages the existing job query already used across the codebase. That information is exposed via the PipelineIsPaused() func. With this info, the scheduler can now detect if the job or pipeline is paused and take a shorter path, skipping all the algorithm calls. We then rely on db.Job.ScheduleBuild() to see that the job or pipeline is paused, and not schedule any pending builds. I was also able to remove one query from db.Job.isPipelineOrJobPaused() since the info it queried for was now part of db.Job.pipelinePaused. Overall there should be very minimal impact on performance from this change. Signed-off-by: Taylor Silva <[email protected]>
Signed-off-by: Taylor Silva <[email protected]>
users could manually do this, but its easier to have Concourse itself abort the pending builds for users. Signed-off-by: Taylor Silva <[email protected]>
taylorsilva
commented
Apr 10, 2026
Comment on lines
+619
to
+620
| if j.paused || j.pipelinePaused { | ||
| return false, nil |
Member
Author
There was a problem hiding this comment.
Don't need to check the archive status of a pipeline because an archived pipeline is also marked as paused.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes proposed by this PR
closes #9519
This PR fixes a bug and adds an enhancement.
Notes to reviewer
This bug was introduced in v6.0.0 when big changes were made to the
scheduler and related db components. It was made by a change to the
JobFactory query that fetches jobs that need scheduling. The query would
filter out jobs and pipelines that were paused, making it impossible for
us to abort any builds that were part of paused jobs or pipelines.
Changing this query alone fixes the bug without any weird scheduling
regressions. The rest of the changes are to ensure we don't consume any
more resources than we need to, ensuring performance doesn't degrade
since we'll definitely fetch more builds now.
First, I had to update db.Job to include info about its pipeline being
paused or not. That leverages the existing job query already used across
the codebase. That information is exposed via the PipelineIsPaused()
func.
With this info, the scheduler can now detect if the job or pipeline is
paused and take a shorter path, skipping all the algorithm calls.
We then rely on db.Job.ScheduleBuild() to see that the job or pipeline
is paused, and not schedule any pending builds. I was also able to
remove one query from db.Job.isPipelineOrJobPaused() since the info it
queried for was now part of db.Job.pipelinePaused.
Overall there should be very minimal impact on performance from this
change.