Remove pending builds from the queue when builds can not be processed
Problem
As brought up by @grzesiek when working on denormalizing shared runners information to ci_pending_builds
:
I think that this iteration might not be complete if we do not update pending builds whenever builds get disabled or a project gets removed, or shared runners get disabled (like in case of the CI minutes where we need to update
ci_pending_builds
when someone purchases new minutes). We can implement that in a separate merge request if you feel that this would be desirable.
This will make sure we ensure data consistency when using our new queuing mechanism.
Solution
Option 1
We need to update ci_pending_builds#instance_runners_enabled
when:
-
Projects get removed -
Builds get disabled for the project -
Shared runners are getting disabled / enabled in a project or a group
Do no queue not active builds
We could leverage our existing prerequisite abstraction which runs some business logic before transition a build as pending
.
This has the advantage of not dealing with more denormalization data to ci_pending_builds
and not having to deal with data integrity issues.
cc @grzesiek