Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure DevOps Build with Parameters

Is it possible in azure-pipelines.yml to define multi-value at runtime parameters so when you run the build you have to input so values

parameters:
  - name: image
    displayName: Pool Image
    type: string
    default: ubuntu-latest
    values:
    - windows-latest
    - vs2017-win2016
    - ubuntu-latest

Upon clicking Run in Azure DevOps you are presented with a dropdown and you select which option you require ???

Upon your selection, the build will only run certain steps or tasks based on your selection

like image 318
stravze Avatar asked Jul 21 '26 16:07

stravze


1 Answers

I am not sure when it was added, but drop down parameters are now available:

parameters:
  - name: env
    displayName: Environment
    type: string
    values:
      - dev
      - prod
      - test
      - train
    default: train

will provide me with a drop down of dev, prod, etc., prepopulated with the value train.

Moreover, it will be a drop down if 4 values or more, and a radio dial with 3 or less. For instance,

  - name: department
    displayName: Business Department
    type: string
    values:
      - AI
      - BI
      - Marketing
    default: AI

will create a radio dial with AI selected by default. Note that the YAML is identical between the two, with the exception of 4 values in the first and 3 in the second.

like image 125
Mike Williamson Avatar answered Jul 25 '26 02:07

Mike Williamson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!