My aim is to use a variable group to hold global configuration settings which apply to all pipelines. Specifically, I want the ability to flip a switch in a variable value to switch from using hosted build agents to using private build agents instead.
I have a variable group named my-variable-group which contains a variable named UseHostedAgents. I can toggle its value between true and false.
The pipeline:
variables:
- group: my-variable-group
stages:
- stage: deploy
pool:
${{ if eq(variables['UseHostedAgents'], 'true') }}:
vmImage: ubuntu-latest
${{ else }}:
name: private-pool
jobs:
...
I can't figure out how to get this to work. It seems as though the variable group variable values aren't available in the conditional insertion expression. I've tried everything I can think of to no avail. Any ideas?