Reputation: 1944
I have an existing YAML Azure Dev Ops Pipeline.
In order to build/ deploy a new release, users have to press the Run Pipeline
button in Azure Dev Ops.
Which brings up the following menu:
I would, at this point, like to ask the user to set the value of a variable.
Something to prompt them & prevent them from proceeding. Is that possible to do via a YAML pipeline? If so, how can I achieve this?
The idea is for me to ask the user for an input before allowing them to proceed & create a new build etc. as there is a build step which relies on said variable to be set prior to build.
Upvotes: 3
Views: 2999
Reputation: 980
With the following YAML code, yu can achieve something like below.
parameters:
- name: Mode
displayName: Specify the mode
default: DEV
type: string
The parameter must be referenced in the template using ${{ parameters.Mode}} , the other variable syntaxes don't work.
Upvotes: 3
Reputation: 41755
I don't think you can make a variable as mandatory, but as you said, you can add a simple step to check if the user is put some value:
- task: PowerShell@2
inputs:
targetType: 'inline'
script: |
if($env:testVariable -eq "")
{
Write-Error "testVariable variable is empty!"
}
Upvotes: 2