Support Resource Group for cross-project and parent-child pipelines

Problem to solve

As a user who is using parent-child pipelines, and needed to limit the number of consecutive deployments to a resource group, I need a way to define the lock for downstream pipeline.

Further Details:

In our case deployment process is done in child pipelines. Deployment process contains multiple stages and multiple jobs. Currently resource groups can be defined only standalone job, instead of bridge-type job that triggers downstream pipeline. It would be very convenient if the full deployment process could be locked by using resource groups. So basically it would be good to have a possibility to define resource group for a triggered child pipeline. Provide the possibility to define resource group for trigger job.

Proposal

When resource_group is defined in cross-project pipelines context, the bridge job obtains the resource lock. This resource lock is released when the downstream pipeline has finished.

We extend the Resource Group architecture to Ci::Bridge (trigger).

The full implementation details are captured in the PoC MR.

Example: Parent-Child Pipelines

# .gitlab-ci.yml (parent)

deploy-downstream:
  trigger:
    include: child.gitlab-ci.yml
    strategy: depend
  resource_group: iOS                # New
# child.gitlab-ci.yml (child)

deployment:
  script: sleep 5s

Bridge jobs (concurrent deployment pipelines) are correctly waiting for the current deployment pipeline has finished.

screenshot_229

screenshot_230

Example: Cross-Project Pipelines

# .gitlab-ci.yml (upstream project)

deploy-downstream:
  trigger:
    project: root/cross-project-resource-group-downstream
    strategy: depend
  resource_group: iOS
# .gitlab-ci.yml (downstream project)

deployment:
  script: sleep 5s

Bridge jobs (concurrent deployment pipelines) are correctly waiting for the current deployment pipeline has finished.

screenshot_232

Documentation

Out of Scope

References

Edited by Shinya Maeda