Azure devops pipeline: read parameter values from a yaml and formulate a checklist

Viewed 23

Is there a way to provide flexibility to select a subset of hosts to deploy the code to based on the environment selected? Side note: It is not a release pipeline

  1. Get value for environment parameter
pipeline.yml

parameters:
 - name: env
   displayName: "Select the environment"
   values:
    - Development
    - Regression
 - name: target_hosts
   displayName: "Target Hosts"
   values:
   # Populate host list based on env selected allowing multiple-choice selection (with checkboxes, not radio button)

  1. Based on the environment selected read from configs/{env}/inventory.yml and populate the parameter values:
inventory.yml

hosts:
 - hostA
 - hostB
 - hostC

Or if there is an altogether better way to achieve this, please let me know. Thanks!

1 Answers

From your description I probably understand what you want to do. You want to define a yml file dedicated to storing parameters, and then 'reuse' the parameters in this yml, right?

If so, then this is not possible now(No such design of parameter reuse in pipeline).

Variables reuse is feasible in pipeline usage, but parameters reuse isn't.

In addition, the value provided by values at the parameter will be the radio button, which is designed in this way, and can only have one value.

Related