'Merging into a trigger for GitLab CI

I have a gitlab-ci.yml that works for normal stages.

.install-template: &install_env
  before_script:
    ...
  after_script:
    ... 

unit-tests:
  <<: *install_env
  stage: test
  script:
    ...
...

I am now trying to do some dynamic children pipelines. I can get them to kick off just fine, however I can't figure out how to merge "install_env" into them.

This fails:

...
trigger:
  <<: *install_env
  stage: test_run_trigger
  trigger:
    include:
      - artifact: triggers.yml
        job: create_yaml

with:

jobs:trigger_algorithms config contains unknown keys: before_script, after_script
jobs:trigger_algorithms config should contain either a trigger or a needs:pipeline

Anyone know how to get ".install-template: &install_env" into the triggered pipeline?

UPDATE: So far the only way I have gotten this to work is I have to copy the all the contents of .install-template: &install_env into the dynamically created trigger.yml and then have <<: *install_env in each trigger call.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source