0

I want to refer to template file as shown below:

variables:
  - template: code-quality/code-quality-variables['Build.Repository.Name'].yml
  #- template: code-quality/code-quality.yml

How can I access the template file name dynamically based on the repository name?

variables['Build.Repository.Name'] is taken as-is instead of resolving it dynamically in azure pipeline.

I also tried to do this using a parameter

- name: codeQuality
  type: string
  default: concat('code-quality/code-quality', '-', variables['Build.Repository.Name'])

**

Also, in parameters is it possible to refer to a dynamic variable name?

qualityEnabled: ${{variables.variables['Build.Repository.Name']_allowQuality}}
#qualityEnabled: ${{variables.repositoryname_allowQuality}}

I want the variable name variables['Build.Repository.Name']_allowQuality to be resolved as respectiverepositoryname_allowQuality

firstpostcommenter
  • 2,328
  • 4
  • 30
  • 59

1 Answers1

0

Template name can be dynamic.

  - template: code-quality/code-quality-${{variables['Build.Repository.Name']}}.yml

If you want a list of values in a variable template then do this way:

variables:
  sampleList: |
    some-value
    some-other-value

Now you can use contains method

firstpostcommenter
  • 2,328
  • 4
  • 30
  • 59