Skip to content

Split Builds Service to calculate minutes sync

Allison Browne requested to merge ab-cancel-on-delete into master

What does this MR do?

This is part of pipeline cryptomining abuse measures. We want to cancel pipelines before deleting them because minutes are not accumulated on deleted jobs that continue to run. In order to cancel pipelines before deleting them and have minutes accumulate properly, we need to compute the minutes synchronously before the destroy to pass off to an async worker that can do the rest.

This MR breaks apart the UpdateBuildsMinute service into 2 so that part of the logic can be executed async. There are no changes to the existing behavior in this code. Also, this MR does not yet introduce the Ci::Minutes::UpdateMinutesByConsumptionWorker that would move the logic of updating based on the consumption to async. That will come in another MR.

There is also a separate MR to introduce a feature flag:

!65586 (merged)

Issue:

https://gitlab.com/gitlab-org/gitlab/-/issues/331891

Screenshots or Screencasts (strongly suggested)

I tested that deleting a pipeline still works manually on my gdk and I tested minute accumulation by running a build to accumulate minutes after ensuring build.shared_runners_minutes_limit_enabled? returns true and the monthly tracking is enabled locally via Feature.enable(:ci_minutes_monthly_tracking.

Screen_Shot_2021-07-09_at_9.31.31_AM

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

Does this MR contain changes to processing or storing of credentials or tokens, authorization and authentication methods or other items described in the security review guidelines? If not, then delete this Security section.

  • 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
Edited by Allison Browne

Merge request reports

Loading