I am trying to reuse a variable output by one job in another (both within the same stage), as described in the documentation, but I can't get it to work. The same solution is also documented in this question.
I'm using a PowerShell script that is outputting the variable -
Write-Output "##vso[task.setvariable variable=WEBSITE_CONTENTSHARE;isOutput=true]some-value-dh8e"
And then I'm setting the variable in the next job like this. Note that Output_Required_App_Settings
is the name of both the job and the task that is outputting the variable WEBSITE_CONTENTSHARE
-
- deployment: Deploy_ARM_Template
displayName: Deploy ARM Template
dependsOn:
- Output_Required_App_Settings
variables:
- name: parameters.functionAppSettings.value.WEBSITE_CONTENTSHARE
value: $[dependencies.Output_Required_App_Settings.outputs['Output_Required_App_Settings.WEBSITE_CONTENTSHARE']]
vmImage: ubuntu-latest
However, the value of parameters.functionAppSettings.value.WEBSITE_CONTENTSHARE
is empty when I use it, meaning that my deployment fails.
In case anyone wonders, the reason for the long name is because I am using JSON path replacement in this job to insert the value of WEBSITE_CONTENTSHARE
into an ARM template parameters file.
How can I share a variable between jobs?