Skip to content

Refresh CI minutes cache after updating limits

What does this MR do?

Ci::Minutes::RefreshCachedDataService is responsible for updating the values in ci_pending_builds.quota_exceeded so any time the namespace's CI minutes limits change we should reflect quota_exceeded correctly.

This MR fixes a bug where Ci::Minutes::RefreshCachedDataService was called before updating the namespace's shared runners minutes limits. In other words, it wasn't reflecting the actual value of quota_exceeded into ci_pending_builds.

Imagine the scenario where a namespace has ran out of CI minutes:

  • ci_pending_builds.quota_exceeded is true for all the newly added builds for the given namespace
  • The customer purchases additional minutes (extra_shared_runners_minutes_limit updated) or upgrades to a higher plan (shared_runners_minutes_limit updated).
  • The customer now has CI minutes available to use but because we run RefreshCachedDataService before updating the limits, we update all the namespace's pending builds quota_exceeded to be true.

By refreshing the cached data after updating the limits, the quota_exceeded would be correctly set to false since CI minutes are available again.

What impacts does this bug have?: This may only impact builds that remained stuck in pending state because of CI minutes exceeded. After the customer purchases additional minutes, these builds remain stuck and are not processed as expected. User may cancel them and retry the build/pipeline.

Screenshots or Screencasts (strongly suggested)

How to setup and validate locally (strongly suggested)

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 Fabio Pitino

Merge request reports