global.yml
parameters:
- name: environment
type: string
variables:
- ${{ if eq(parameters.environment, 'd') }}:
- name: location
value: westeurope
- ${{ elseif eq(parameters.environment, 't') }}:
- name: location
value: westeurope
- ${{ elseif eq(parameters.environment, 'i') }}:
- name: location
value: northcentralus
build.yml
variables:
## Variables group from pipelines library
- group: SOME-GROUP
### Template vars
- template: templates/vars/global.yml
parameters:
environment: $(env)
$(env) is the variable set at Azure Pipeline UI.
The global.yml file serves as the template for loading variables, while the build.yml file is the build pipeline that utilizes global.yml. However, I’m encountering an issue where the template expressions in global.yml are not functioning as expected. Specifically, the location variable remains null despite the parameters.environment being set to ‘d’. I have already invested a considerable amount of time attempting to resolve this issue without success. Could someone please assist in determining if this is a solvable problem?
Sanket Gupta is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.