I have two environments on azure. One difference between them is only environment variables that came from variable groups. Is it possible to set up group name dynamically for one pipeline instead of set up two pipelines that can map their own group variables? It is an example of my build pipeline
trigger:
- master
- develop
jobs:
- job: DefineVariableGroups
steps:
- script: |
if [ $(Build.SourceBranch) = 'refs/heads/master' ]; then
echo "##vso[task.setvariable variable=group_name_variable;isOutput=true]beta_group"
elif [ $(Build.SourceBranch) = 'refs/heads/develop' ]; then
echo "##vso[task.setvariable variable=group_name_variable;isOutput=true]alpha_group"
fi
name: 'DefineVariableGroupsTask'
- script: echo $(DefineVariableGroupsTask.group_name_variable)
name: echovar # that works.
- job: Test
dependsOn: DefineVariableGroups
pool:
vmImage: 'Ubuntu-16.04'
variables:
- group: $[ dependencies.DefineVariableGroups.outputs['DefineVariableGroupsTask.group_name_variable'] ]
# that doesn't work. Error here
steps:
- script: echo $(mode)
displayName: 'test'
name: 'DefineVariableGroupsTask'
? – Hedvig