使用变量对构建进行排队,失败并出现错误 TF400898:发生内部错误

问题描述 投票:0回答:1

我正在使用 Rest API 对新构建进行排队。当 UNC 路径类似于下面的路径时,它会失败

\\xxx.com\global\Engineering\Builds\Agile

Invoke-RestMethod : {"$id":"1","innerException":null,"message":"TF400898: An Internal Error Occurred. Activity Id: c3442c5b-8ab6-4102-a22b-5d569cb7271c."

唯一有效的方法是将 UNC 更改为:

\\\\xxx.com\\global\\Engineering\\Builds\\Agile

此问题的原因是什么以及如何解决?

这是我的代码:

$BuildPath = "\\xxx.com\global\Engineering\Builds\Agile"
$BranchName = "v8.6.4x-SP"

$release = Invoke-RestMethod -Method Get -Uri "https://dev.azure.com/xxx/Idu%20Client-Server/_apis/build/definitions/26845?api-version=5.0-preview" -Headers $header

$body = @{}

$body = @{
    definition = @{
        id = "26845"
    }
    parameters = '{"BranchName":"' + $BranchName + '","BuildPath":"' + $BuildPath + '"}'
}

$releaseResponse = Invoke-RestMethod -Method Post -ContentType "application/json" -Uri $releaseUri -Body ($body | convertTo-json -Compress -Depth 10) -Headers $header
powershell azure-devops tfs
1个回答
0
投票

我更改了代码,现在可以使用了

$BuildPath = "\\xxx.com\global\Engineering\Builds\Agile"
$BranchName = "v8.6.4x-SP"

$release = Invoke-RestMethod -Method Get -Uri "https://dev.azure.com/xxx/Idu%20Client-Server/_apis/build/definitions/26845?api-version=5.0-preview" -Headers $header

$body = @{}

$body = @{
    definition = @{
        id = "26845"
    }
    parameters = '{"BranchName":"' + $BranchName +'","BuildPath":' + ($BuildPath | ConvertTo-Json -Depth 100 -Compress) + '}' 
}

$releaseResponse = Invoke-RestMethod -Method Post -ContentType "application/json" -Uri $releaseUri -Body ($body | convertTo-json -Compress -Depth 10) -Headers $header
© www.soinside.com 2019 - 2024. All rights reserved.