For Azure DevOps Release pipeline, is it possible to create Dropdown list for custom variables?
So for below, if I wish to have dropdown values instead of single text value
To use a variable group, open your pipeline. Select Variables > Variable groups, and then choose Link variable group. In a build pipeline, you see a list of available groups. In a release pipeline, for example, you also see a drop-down list of stages in the pipeline.
Draft releases are deprecated in Azure Pipelines because you can change variables while you're creating the release. Creating a draft release allows you to edit some settings for the release and tasks, depending on your role permissions before you start the deployment.
If you are going to trigger the pipeline manually then you can make use of Runtime parameters
in the Azure DevOps pipeline.
For Example:
In order to make OS image name selectable from a list of choices, you can use the following snippet.
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 # trigger is explicitly set to none
jobs:
- job: build
displayName: build
pool:
vmImage: ${{ parameters.image }}
steps:
- script: echo building $(Build.BuildNumber) with ${{ parameters.image }}
This results in the following.
More info on Runtime parameters can be found here. Hope this helps.
The only downside with this is that since we are specifying trigger as none we may not be able to integrate into an automatic pipeline. I've not yet tried it. Let me know if it works in an auto pipeline.
Note: The example and image shown here is fetched from azure DevOps documentation.
As I know the dropdown value is not supported yet.
The custom variable in release pipeline is a key-value pair, the value should be one specific value instead of a dropdown list. The value could be single text value
, could be true/false
or other variable using format $(VarName)
from variable group. But we can't pass a dropdown list as value to the variable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With