[go: up one dir, main page]

Skip to content

Nested variables in build:resource_group are not expanded.

Summary

Nested variables used in the YAML build:resource_group key are not expanded. Expansion of nested variables was recently implemented for environment:url. This page in the Gitlab docs states variable expansion for build:resource_group should work similar to that of environment:url, implying it should work, but it does not.

Steps to reproduce

Take the following .gitlab-ci.yml:

variables:
    PARENT_VARIABLE: "parent"
    NESTED_VARIABLE: ${PARENT_VARIABLE}_nested
build:
    script:
        - "echo 'hello'"
        - "sleep 10"
    resource_group: ${NESTED_VARIABLE}

Run several instances of this pipeline at the same time. Subsequent pipeline pages will show "This job is waiting for resource: ${PARENT_VARIABLE}_nested", rather than "parent_nested".

Example Project

https://gitlab.com/rphes/resource-group-expansion-repro

What is the current bug behavior?

Nested variables in build:resource_group are not expanded.

What is the expected correct behavior?

Nested variables in build:resource_group are expanded.

Relevant logs and/or screenshots

Screenshot_from_2022-05-05_13-15-50

Output of checks

This bug happens on GitLab.com

Possible fixes

https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/pipeline/seed/processable/resource_group.rb#L22