I am trying to figure out the syntax to be able to reference a variable within an each loop and replace it with the loop variable.
Here is a very simple example of what I am trying to do.
trigger:
branches:
include:
- develop
variables:
- name: regions
value: ncus,scus
- name: webAppName
value: myapp-<region>
stages:
- stage:
jobs:
- ${{ each region in split(variables.regions, ',') }}:
- job:
pool:
vmImage: 'windows-latest'
steps:
- script: 'echo "replace(webAppName, <region>, region)"'
What I want is the output of the echo statement in the script task to be myapp-ncus and myapp-scus. I know the syntax I have here is incorrect, I just wanted to give some pseudocode representation of what I am trying to do. I’ve tried all combinations of $(), ${{ }}, $[], but nothing seems to work.
Recognized by CI/CD Collective
2