Reputation: 399
I have a pipeline that uses a variable that can take multiple hardcoded values. This variable is available on the pipeline launch screen, and the user must fill it in. As a result, typos happen and the pipeline doesn't work. Can I make this variable a toggle so that the user, instead of entering a value, selects it from the list of available ones?
Upvotes: 1
Views: 769
Reputation: 40779
You can't do this for variable but you can use ofr that purpose runtime parameters.
For instance:
parameters:
- name: image
displayName: Pool Image
type: string
default: ubuntu-latest
values:
- windows-latest
- vs2017-win2016
- ubuntu-latest
- ubuntu-16.04
- macOS-latest
- macOS-10.14
trigger: none
jobs:
- job: build
displayName: build
pool:
vmImage: ${{ parameters.image }}
steps:
- script: echo building $(Build.BuildNumber) with ${{ parameters.image }}
produces:
Upvotes: 3