Backend: gitlab-ci include:rules does not work with reference

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

Summary

Area: gitlab-ci
Issue: cannot use !reference [<job>, rules] in include:local:rules.
nothing is specified against it in the docs + error message is unclear.
https://gitlab.com/eli.b1/include-rules-reference-error/-/pipelines/604101670

Found errors in your .gitlab-ci.yml:
Undefined error (01G9JB39JQCQNN4CACT30MDHZC)

Steps to reproduce

See example project

Example Projects

What is the current bug behavior?

Pipeline syntax is invalid + undefined error message:

Found errors in your .gitlab-ci.yml:
Undefined error (01G9JB39JQCQNN4CACT30MDHZC)

What is the expected correct behavior?

One of the following (from ideal to worst case):

  • Should work
  • Will not work:
    • Linter will point at problematic area.
    • Have a notice in the documentation.

Relevant logs and/or screenshots

Found errors in your .gitlab-ci.yml:
Undefined error (01G9JB39JQCQNN4CACT30MDHZC)

Output of checks

This bug happens on GitLab.com

Edited by 🤖 GitLab Bot 🤖