Store and track monthly usage of CI Minutes

Objectives

  • Store data about CI usage at monthly intervals with new tables/models
  • Track monthly minutes when a build finishes
  • Compare statistics between the the new tables and those in the current tables project_statistics.shared_runners_seconds and namespace_statistics.shared_runners_second

Technical Approach

Add ci_project_monthly_usage and ci_namespace_monthly_usage tables/models and track monthly minutes in there when a build finishes - this can be done in the background for the first month given that the usage would be partial. On the 1st of the month after this is deployed, statistics should match those in project_statistics.shared_runners_seconds and namespace_statistics.shared_runners_seconds. At this point we will have ways side-by-side to track CI minutes usage but only the old way is being enforced.

Edited by Fabio Pitino