Drop user pipelines async when user is blocked
What does this MR do?
Related to #327263 (closed)
This MR fixes a bug where build trace chunks are not migrated for dropped builds when a user is blocked.
When a user is blocked we run Ci::AbortPipelinesService
which forcefully drops cancelable builds by updating the status in the database column rather than calling build.drop
for each build which also triggers state machine callbacks.
When dropping builds, however, state machine callbacks are important since they also perform cleanup code such as migrating trace chunks.
In this MR, rather than using Ci::AbortPipelineService
, which might be fine to use when a project is deleted, we introduce a new Ci::DropPipelineService
which will asynchronously drop pipelines for the user being blocked.
We used Ci::AbortPipelinesService
to reduce N+1s when a user is blocked. This MR reintroduces the processing of builds 1 by 1 in order to run each build's callbacks. The main difference though is that each pipeline is dropped asynchronously. By being an async operation, the user can be blocked immediately while we proceed with stopping any running pipelines.
Does this MR meet the acceptance criteria?
Conformity
-
📋 Does this MR need a changelog?-
I have included a changelog entry. -
I have not included a changelog entry because _____.
-
-
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team