I have created a build with an Ubuntu agent, and I'm trying to access my pipeline variables through a powershell task, but it always returns an empty value. By contrast, when I run the same script on a Windows agent it can get the value correctly.
The script that I use is:
Write-Host "My Variable is $env:URLAPI"
Write-Host "My Another Variable is $env:Build.BuildNumber"
I just want to know why this works on Windows Agent and not on the Ubuntu Agent.
Thank you
$env:var
, but in Ubuntu, you should do that like$var
. – Charles Xu$ {env: Build.BuildNumber} = '170.42'; Write-Host "My other variable is $ {env: Build.BuildNumber}"
. Tested onLinux 4.15.0-46-generic # 49-Ubuntu SMP Wed Feb 6, 09:33:07 UTC 2019
inPowerShell 6.1.3 Core
. – Andrei Odegov