CI/CD include anchors and templating support

Summary

Gitlab CI pipeline inclusion is a great feature. But anchors and templating doesn't work if both are in different files, and it's certainely the most interesting feature.

The idea there is to produce various include with a catalog of steps which can be used as templates from child yml, normalizing builds across applications

Steps to reproduce

Create a inclusion file with the following content

.app_services:
  services: &app_services
    - postgres:latest

Create a .gitlab-ci.yml with the following step

include: "/myinclude.yml"
build:
  services: *app_services

Example Project

here is a sample project with the cross anchor/template awaited feature

https://gitlab.com/nerzhul/ci-pipeline-include-failure/tree/master

What is the current bug behavior?

LINT fail with error

Unknown alias: app_services

What is the expected correct behavior?

The pipeline should run and create a build step using app_services from the include. It also should permit to include templates from child if include is defined after the child anchor

Possible fixes

Edited by Mark Fletcher