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

Queuing a build with variables failing with error TF400898: An Internal Error Occurred

提问人:Bandit 提问时间:10/21/2023 最后编辑:Bandit 更新时间:10/23/2023 访问量:119

问:

我正在使用 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"

$releaseUri = "https://dev.azure.com/xxx/Idu%20Client-Server/_apis/build/builds?api-version=5.0-preview"

$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

评论

0赞 Bandit 10/22/2023
我解决了 parameters = '{“BranchName”:“' + $BranchName +'”,“BuildPath”:' + ($BuildPath |ConvertTo-json -depth 100 -compress) + '}'
0赞 Miao Tian-MSFT 10/23/2023
嗨,@Bandit,您可以在下面发布您的答案并接受它。这可能会使将来遇到此问题的其他人受益。

答:

0赞 Bandit 10/23/2023 #1

我更改了代码,现在它正在工作

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

$releaseUri = "https://dev.azure.com/xxx/Idu%20Client-Server/_apis/build/builds?api-version=5.0-preview"

$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