Environment scoped CI/CD variable doesn't work as value in resource_group keyword

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

Resource groups can be used to control the concurrency of jobs. The value of the resource_group keyword can also be set with CI/CD variables.

When using an environment scoped CI/CD variable the resource_group is not respected and concurrent pipelines are run.

Steps to reproduce

  1. Create an environment called ENV1
  2. Create a CI/CD variable that is not scoped to any environment called RESOURCE_ID with any value
  3. Create a CI/CD variable that is scoped to the environment ENV1 called RESOURCE_ID_ENV with any value
  4. Create the following pipeline:
stages:
  - test

test-resource-global:
  stage: test
  script:
    - echo "START"
    - sleep 120
    - echo "END"
  resource_group: $RESOURCE_ID

test-resource-env:
  stage: test
  script:
    - echo "START"
    - sleep 120
    - echo "END"
  resource_group: $RESOURCE_ID_ENV
  environment: ENV1
  1. Start two pipelines after each other

Example Project

https://gitlab.com/loelu/resource-group-locking

What is the current bug behavior?

The job test-resource-global in the newer pipeline is waiting for the resource group. The job test-resource-env is running in both pipelines concurrently.

image

What is the expected correct behavior?

The job test-resource-env should wait for the resource group as well.

Relevant logs and/or screenshots

Output of checks

This bug happens on GitLab.com

Edited by 🤖 GitLab Bot 🤖