YAML anchors for script should work with `include` from another yml file

Problem to solve

YAML anchors for script not working with include from another yml file.

Intended users

Developer, DevOps engineer

Further details

If implemented, will help being able to re-use code scripts from certain templates. Will almost become like a "script functions".

Example:

# file: some-group/some-project/utils.yml

.echo-message: &echo-message
- echo $MESSAGE
# file: .gitlab-ci.yml

include:
  - project: "some-group/some-project"
    file: "/utils.yml"

job1:
   script:
      - echo "Hello world"
      - MESSAGE="Hello again"
      - *echo-message

Proposal

Add support for this the same way extends helped with cross-file "injection".

Testing

What does success look like, and how can we measure that?

Implemented feature is the measure of success.

Assignee Loading
Time tracking Loading