Skip to content

[Docs] Misinformation about nesting `!reference`

There is information:

You can't reuse a section that already includes a !reference tag. Only one level of nesting is supported.

But today my colleague did some refactoring and used something like this:

.notification:
  icon:
    - MSG_ICON=$(if [[ $CI_JOB_STATUS == "success" ]]; then echo ":white_check_mark:"; else echo ":warning:"; fi)
  image_build:
    - !reference [ .notification, icon ]
    - ...

.actual_job:
  script:
    - ...
  after_script:
    - !reference [ .notification, image_build ]

and it worked properly 🤔 So what is the current state of !reference - does it support nesting? If yes, what are the limitations? Or maybe the wording is incorrect, so in fact "one level of nesting is supported" (and then "You can't reuse a section that already includes a !reference tag" is misleading)?

We use Gitlab 14.10.