Forum Discussion
tanulbhasin
Mar 06, 2023Brass Contributor
Pass variable value to a job in a template from previous job
Hello,
This is my yaml pipeline
stages:
- stage: 'build'
displayName: 'Build'
jobs:
- job:
steps:
- task: CmdLine@2
name: 'calculateAppVersion'
displayName: 'Calculate Chart Versions'
inputs:
script: |
chartVersion="abcd1234"
echo "##vso[task.setvariable variable=chartVersion;isOutput=true]$chartVersion"
- template: ./template-scan.yaml
This is my template-scan
jobs:
- job: 'scan'
variables:
containerTag: $[ dependencies.${{parameters.dependentJob}}.outputs['setVariable.chartVersion'] ]
steps:
.
.
.
I am unable to access the container Tag value. Its always blank in template. Does this approach of dynamically creating the variable and then reading it in another job within template works.. If not, can anyone suggest some solution.
Thank you.
Kind Regards,
Tanul
- My mistake. It should be like this
calculateAppVersion.chartVersion
- tanulbhasinBrass ContributorMy mistake. It should be like this
calculateAppVersion.chartVersion