If you are using the git branching strategy, in your development, you probably have these three branches that are connected to the following environments.
- feature/* → DEV
- master → TEST
- release/* → PROD
To choose the group variable we use the ‘if else’ statement. so the pipeline will be like…
variables:
- ${{ if eq(variables['Build.SourceBranchName'], 'develop') }}:
- group: 'gr_dev_app'
- ${{ elseif eq(variables['Build.SourceBranchName'], 'stage') }}:
- group: 'gr_test_app'
- ${{ elseif eq(variables['Build.SourceBranchName'], 'main') }}:
- group: 'gr_prod_app'
Add your variable group name in “- group” based on the environment.
Dont forget the triggers to add
trigger:
branches:
include:
- develop
- stage
- main