Support extends in workflow

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

Problem to solve

As explained in #227093 (closed), YAML anchors are not usable when they are included in a file via include:.

This forces users to define hidden jobs like the following:

# In common-yaml-code/rules.yml
.my-if-condition: &my-if-condition
  if: $CI_PIPELINE_SOURCE == "merge_request_event"

.hidden-job:
  rules:
    - << *my-if-condition

# In a .gitlab-ci.yml

include: "/common-yaml-code/rules.yml"

my-job:
  extends: .hidden-job

# trying to reuse my-if-condition fails

Fair enough, a bit cumbersome but extends does the trick.

Unfortunately, extends is not supported inside workflow:

worfklow:
  extends: .hidden-job

CI Lint complains that workflow config contains unknown keys: extends.

I think this should be supported. Or maybe fixing #227093 (closed) will supersede this feature request?

Edited by 🤖 GitLab Bot 🤖