Skip to content

WIP: Allow nested variables

What does this MR do?

Add support for deep-nesting variables

Examples

Normal deep nesting

variables:
    A: 'aa${B}'
    B: 'bb${C}'
    C: 'cc${D}'
    D: 'dd'

is rendered to:

$ echo $A
aabbccdd
$ echo $B
bbccdd
$ echo $C
ccdd
$ echo $D
dd

Deep-nesting with self reference

  variables:
    A: 'aa${D}'
    B: 'bb${A}'
    C: 'cc${B}'
    D: 'dd${A}'

is rendered to:

$ echo $A
aa
$ echo $B
bb
$ echo $C
cc
$ echo $D
dd

Each expansion in the example leads to deep self reference, so they all implicitly result in empty string.

Design discussion

#1809 (comment 187808798)

Highlights

  • the MR would need it's Ruby app counterpart to handle things like CI environment name and URL
  • validating variables that are currently processed on runner is not an option, they all can be redefined on runner level
  • we shouldn't fail job on recursive variable expansion to avoid being backward incompatible
  • maybe optional job failing on both unset variables and recursive self reference is a good idea

Does this MR meet the acceptance criteria?

  • Documentation created/updated
  • Added tests for this feature/bug
  • In case of conflicts with master - branch was rebased

What are the relevant issue numbers?

#2007 (closed)

Closes #1809 (closed)

Edited by 🤖 GitLab Bot 🤖

Merge request reports