Hey I am looking for a way to dynamically build the displayName
on a Azure Devops pipeline.
This is my current setup:
jobs:
- job: RunTests
displayName: 'Run Tests on $(vmImage)'
timeoutInMinutes: 60
strategy:
matrix:
windows:
vmImage: 'windows-latest'
mac:
vmImage: 'macos-latest'
pool:
vmImage: $(vmImage)
steps:
- ...
When looking in the UI, I would like to have it so that the Job Name displays what image it is using for the agent.
Currently the $(vmImage)
variable is not getting filled in
To achieve that you need to use ${{ variables.vmImage }} because it is set at compilation time. More info https://learn.microsoft.com/en-us/azure/devops/pipelines/process/variables?view=azure-devops&tabs=yaml%2Cbatch
jobs:
- job: RunTests
displayName: 'Run Tests on ${{ variables.vmImage }}'
timeoutInMinutes: 60
strategy:
matrix:
windows:
vmImage: 'windows-latest'
mac:
vmImage: 'macos-latest'
pool:
vmImage: $(vmImage)
steps: