Add canceling state for jobs
What does this MR do and why?
This MR adds a canceling
state which a processable will transition to prior to the cancelled
state when the flag is on.
The eventual outcome is that, while the job is in the canceling
state the after_script
will run on the runner. This will require some runner updates which are captured in gitlab-runner#30827 (closed). The feature flag ci_canceling_status
should not be enabled until that is complete.
For now this is WIP and not meant to be turned on until:
- We have runner support for the cancelling status gitlab-runner#30827 (closed)
- We account for or ensure that older versions of runner will not have issues with handling the canceling state.
This will come in other MRs and issues in the epic.
Screenshots or screen recordings
Before | After |
---|---|
![]() |
![]() |
![]() |
![]() |
How to set up and validate locally
- In rails console enable the feature flag
Feature.enable(:ci_canceling_status)
- Create a pipeline with jobs to cancel:
job1: script: sleep 60
- Start the pipeline and wait for the job to be 'running'
- Find the job in the rails console and send the cancel signal(or via the ui):
[2] pry(main)> CommitStatus.find_by_id(2584).status => "running" CommitStatus.find_by_id(2584).cancel! => "canceling"
- Observe that the job is marked as
canceling
- Observe that the pipeline is marked as
canceling
- Observe that the job transitions to
canceled
Related to #399215 (closed)
Edited by Allison Browne