I'm trying to pass a variable value from one job to another in a Azure Devops pipeline.
I've tried following the documentation in Microsoft docs diligently.
For example here:
- https://learn.microsoft.com/en-us/azure/devops/pipelines/process/variables?view=azure-devops&tabs=yaml%2Cbatch
- https://learn.microsoft.com/en-us/azure/devops/pipelines/process/expressions?view=azure-devops
However, it's not working as expected.
Can anyone point out where the problem is?
Here's the pipeline
https://github.com/ossentoo/azure-devops-pipelines
jobs:
- job: A
steps:
- script: echo "##vso[task.setvariable variable=applicationId;isOutput=true]629ae9cb-95e0-46b7-8a88-a4034b68323e"
name: mytask
- job: B
variables:
newValue: $[dependencies.A.outputs['mytask.applicationId']]
dependsOn: A
steps:
- powershell: |
Write-Host "This value is: ${{variables.newValue}}"
displayName: 'Output the value'
the output from this pipeline in the Powershell task is:
This value is: $[dependencies.A.outputs['mytask.applicationId']]
You can see the output here:
It is almost as if $[]
is not being recognized by Azure DevOps as a variable value.
thanks