Is there a way to persist changes in environment value between tasks in Visual Studio Team Services? I'm using Powershell to change it but it only changes it in the task not the whole process.
Write-Verbose "Before: $Env:SuperVersion"
$Env:SuperVersion = $NewVersion
Write-Verbose "After: $Env:SuperVersion"
Write-Verbose "Final: $Env:SuperVersion"
I see the change at After but Final is always getting the original value
Logging command called task. setvariable lets us pass variables across Tasks. Task. setvariable sets the value to a variable which by default can be used in any Task within a Job or across the Jobs of a given Stage.
PY-yaml library doesn't resolve environment variables by default. You need to define an implicit resolver that will find the regex that defines an environment variable and execute a function to resolve it. You can do it through yaml.
To set environment variables when you start a container in the Azure portal, specify them in the Advanced page when you create the container. Under Environment variables, enter NumWords with a value of 5 for the first variable, and enter MinLength with a value of 8 for the second variable.
Based on this issue following line will do the trick.
Write-Host ("##vso[task.setvariable variable=SuperVersion;]$NewVersion")
You may find more commands like that in here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With