Fix conflict between canceling methods
What does this MR do and why?
Fix conflicts between canceling
method names.
Active Record enum adds methods like canceling!
for each
status on a Stage.
We also defined canceling!
as a state machine
event which conflicts with the enum method.
Here we rename the event method from the state so we can take advantage of the
state machine event controls and still transition to canceling
.
For the CommitStatus
it's safe to run cancel
and have the event code determine when to transition to canceling
or canceled
based on what the current state is.
For the Stages and Pipelines, it's safer to directly set the status to canceling
and canceled
via start_cancel
and finish_cancel
:
- since some processing happens ascync for the stages, pipelines
- we can't depend on checking if
canceling
is supported for a pipeline or stage as easily since this is based on the builds runner. Seebuild.supports_canceling
which is set on thebuild_metadata
.
I did not re-name all cancel
's to finish_cancel
in this MR as it would greatly increase the scope and risk of the change.
To verify
- Temporarily bring this MR into the branch: !150038 (merged)
- in the stages model make the change to move
Importable
aboveCi::HasStatus
:
include Importable
include Ci::HasStatus
- Run the static verification that failed locally: https://gitlab.com/gitlab-org/gitlab/-/jobs/6685075446#L884
source scripts/utils.sh
fail_on_warnings scripts/static-analysis
- It should pass.
- It should fail on the branch from this MR, with the same ruby model change