Limiting jobs sharing a resource (making resource_group a counting semaphore ?)
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Proposal
resource_group introduced in Gitlab 12.7 allows only one job that acquire the resource like a binary semaphore or a mutex. Ref. It would be benefical if number of resources can be changed, not fixed to one.
Why?
I am using CI to compile the projects. In some cases, some compilers are licensed and we have some number of, say n, floating licenses. I would like to limit total number of jobs using the license to n. However the resource limit scope should not be limited to project level (I think current resource_group scope is project level), user should be able to set scope of the resource to project/group/global level.
Example
A possible description can be:
job1:
script: deploy
resource_group:
- name: production
# if not set, default is 1. In this case, 3 simultaneous jobs can be run
count: 3
# if not set, default is project. Possible values: project, group, global
scope: group
The correct place for settings may not be the .gitlab-ci.yml. What if two projects set different count values for the same resource in their YAML files? Correct place to set the limit can be web interface.
I don't know how many users can benefit from this proposal. My need is to limit number of jobs at group or global level sharing some number of limited resources.
Thanks.