Dynamically include variable groups for each env

·

1 min read

#build-stage.yml
stages:
  - stage: Build
    ${{ if eq(parameters.enableVariableGroups, 'true') }}:
      variables:
      - ${{ each group in parameters.variableGroupNames }}:
          - group: ${{ group }}

df

#main-pipeline.yml

stages:
- template: build-stage.yml@Templates
  parameters:
    environment: dev
    variableGroupNames: 
      - "demo-variable-group"
      - "another-demo-variable-group"