In first stage,stage1, in one step, I’m extracting some variables using output variables syntax for it to be available to next stages.
I have different files for stage and job.
In next stage I’m defining these extracting variables using stage dependencies syntax.
- stage: STAGE2
pool:
name: $(agent_pool)
variables:
RELEASE_TYPE: $[ stageDependencies.stage1.job1.output['step1.RELEASE_TYPE']]
displayName: stage2
jobs:
- template: /job/main.yaml
parameters:
release: $(RELEASE_TYPE)
In the job2 file(/job/main.yaml) below, in steps, I want to access this variable in template file path.
parameters:
- name: release
type: string
jobs:
- deployment: Release
displayName: Job2
pool: $(agent_pool)
strategy:
runOnce:
deploy:
steps:
- template:/step/${{ parameters.release }}/login.yaml
Please ignore indentation errors.
The problem is when I try to run the pipeline, it gives error, basically ${{parameters.release}} not expanding.
I know that {{ }} is a compile time syntax, but is there any way to use runtime variable of previous stage into the template file path inside job of next stage??
Thanks for help in advance.
4