当我执行Release管道时,我有一个Powershell任务,但是它说它不是git存储库,我尝试使用Release管道变量,但它似乎不起作用。
try
{
"Initiated"
Set-Location "$(System.ArtifactsDirectory)"
git remote add target https://maliranguesnunezcontractor@dev.azure.com/maliranguesnunezcontractor/PDemo/_git/PDemo
"Added target"
}
catch [System.Management.Automation.CommandNotFoundException]
{
"Error"
}
答案 0 :(得分:0)
我得到了答案,问题是文档中描述的环境变量的格式不起作用,最终我能够找到释放管道用来将位置更改为包含存储库的文件夹的格式,以及如何得到它,这就是答案:
Function Get-EnvironmentVariable {
param([string]$Name)
Return [Environment]::GetEnvironmentVariable($Name)
}
try
{
"Initiated"
$SystemToken = Get-EnvironmentVariable -Name 'SYSTEM_ARTIFACTSDIRECTORY'
Set-Location $SystemToken\gitFolder
"Chnged Location"
}
catch [System.Management.Automation.CommandNotFoundException]
{
"Error"
}