microsoft / azure-pipelines-yaml

Azure Pipelines YAML examples, templates, and community interaction
MIT License
1.21k stars 934 forks source link

How to concatinate value in loop using YAML #575

Open SwardCoder opened 2 years ago

SwardCoder commented 2 years ago

i have an azure pipeline with parameters and I want to get a variable value filled by concatenating the parameter's name but when I tried to do that using YAML loop its threw error

parameters:
  - name: applications_module
    displayName: Applications
    type: boolean
    default: 'false'
    values: []
  - name: management
    displayName: Management
    type: boolean
    default: 'false'
    values: []
  - name: It
    displayName: IT_module
    type: boolean
    default: 'false'
    values: []

variables:
- name: allValues
    ${{each item in parameters}}:
      ${{if contains(item.name, '_module')}}: 
      value:  ${{ allValues = item.name }}
       # here I want to concatenate all the parameters names that have name _module but this statement is throwing an error 

Unexpected symbol: '=item' is the Error so can any one help me how to concatenate all the parameters as comma separated into a single variable i tried all ways and came back here :(

guidooliveira commented 1 year ago

Excellent feature suggestion