azure devops yaml - consuming variable outputs from a multistage build
This is an example that show how we can output a variable and consume it in a different stage and different job.
In JobA, we output a variable called myOutput.
Then it is consume in JobB with $(JobA.SetJobOutput.myOutput).
It is also consume in StageB by specifying the stage, job and output name
stages:
- stage: StageA
jobs:
- job: JobA
steps:
- script: echo "##vso[task.setvariable variable=myOutput;isOutput=true]hello"
name: SetOutput
- job: JobB
dependsOn: JobA
steps:
- script: echo "The output from JobA is: $(JobA.SetJobOutput.myOutput)"
- stage: StageB
dependsOn: StageA
jobs:
- job: JobB
steps:
- script: echo "The output is $(StageA.SetOutput.myOutput)"
Comments