[Tech Debt]: SSOT for selecting child pipelines to cascade cancellation
Proposal
In Issue, #273378 (closed), we used an approach that takes on tech debt because it handles the logic about getting the child pipelines in 2 places(CancelPendingPipelines
and in cancel_running
) by passing in a cascade_to_decendants
parameter. See discussion: #273378 (comment 865976584)
This is because queries were optimized for timeouts in CancelPendingPipelines
and in the interest of fewer changes at once.
In this issue we can switch to using a single source of truth for where we select all the child pipelines for cancelation.
Possible Design
- A service that can accept the root/parent pipeline and an active record relation of child pipelines and cancel all those pipelines, this could be called by cancel_running.
- From
CancelPendingPipelines
don't select and iterate through child pipelines, just pass the parent and anonly_interruptible_pipelines
param to the cancel_running.
Edited by Allison Browne