I want to pass variable between release tasks. (from triggered build to script)
Files:
Script1: (saves a env variable)
Write-Output ("##vso[task.setvariable variable=MyVar;]$MyVarValue")
Script2: (prints the env variable value)
Write-host $env:MyVar
Script3: (same as Script2)
Write-host $env:MyVar
First approach: build
MyBuild:
- Script1
- Script2
This is working properly, the second script writes the value of $env:MyVar created in the first.
Second Approach: release - MyRelease:
- Script1
- Script2
Also works properly.
My problem comes when my release changes to:
- MyRelease:
- Triggered_build (MyBuild)
- Script3
In that last case, the Script3 is not printing the $env:MyVar, so I guess that release uses a different environment than the used for the triggered build?
Is there a way to do something like that?