Add builds minutes / hour limit
In https://gitlab.com/gitlab-org/gitlab-ce/issues/51401#note_200596653 we discussed about some limits to stop users from creating too many CI pipelines.
Problem
Understanding whether a customer (namespace) is abusing Gitlab.com resources is very hard. We tried looking into pipeline_size_limit (max number of jobs in a pipeline) and pipeline_activity_limit (how many pipelines are currently active). While these 2 limits could work as safe-guard for severe resource abuse they would be prone to false positive if set too low.
We also looked into jobs_activity_limit (number of jobs currently alive for the past hour).
Solution
It turns out that the primary CI limit could be calculated in builds minutes / hour.
This would count:
- how long/often shared runners are kept busy for a specific namespace
- how long/often Sidekiq workers are running in order to process jobs for a specific namespace
- this will also cascade to other resource usage: DB, Redis, Workhorse, etc.
It could either be an iteration over jobs_activity_limit or an additional limit.
This could be tied up with the first iteration of CI/CD quotas