trigger:
none
##################
# Drop Down Menu:-
##################
parameters:
- name: environment
displayName: Select environment
type: string
default: 'dev'
values:
- dev
- test
- uat
- prod
#############
#Variables:-
############
variables:
ServiceConnection: 'amcloud-cicd-service-connection' # Please replace with your Service Connection!
BuildAgent: 'windows-latest' # Please replace with your Build Agent. You can continue to use this as this is Microsoft Hosted Windows Build Agent!
######################
# Declare Build Agent:-
######################
pool:
vmImage: '$(BuildAgent)'
##################################
# Declare Stages:-
# Test Runtime parameters as:-
# 1. Dropdown Menu
##################################
stages:
- stage: Test_Runtime_Parameters_DropDown_Menu
displayName: Test Runtime Parameters Dropdown Menu
jobs:
- job: Test_Runtime_Parameters_DropDown_Menu
steps:
- task: AzureCLI@2
displayName: Test Runtime Parameters Dropdown Menu
inputs:
azureSubscription: '$(ServiceConnection)'
scriptLocation: 'inlineScript'
scriptType: 'ps'
inlineScript: |
echo "Deploying to ${{ parameters.environment }} environment"
CODE BLOCK FOR DROPDOWN MENU AS RUNTIME VARIABLES IN YAML:-
##################
# Drop Down Menu:-
##################
parameters:
- name: environment
displayName: Select environment
type: string
default: 'dev'
values:
- dev
- test
- uat
- prod
OUTPUT: DROPDOWN MENU OPTION AS RUNTIME VARIABLES
1. Dropdown Menu as runtime variables is displayed successfully on Pipeline Execution.
2. Successful Pipeline Execution.
3. SPOT THE DIFFERENCE:-
The "type" of the variable is exactly the same except the no. of values. For "Radio button", we entered 3 values but if we needed "Dropdown Menu", we just increased 1 more value. "Radio button" option changes to "Dropdown Menu".
For "Radio button", value count <= 3
For "Dropdown Menu", value count > 3
Hope You Enjoyed the Session!!!
Stay Safe | Keep Learning | Spread Knowledge
Top comments (0)
Subscribe
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)