我有一个PowerShell脚本(Start-TargetBuild.ps1),我从2015 vNext团队构建中调用。此脚本使用REST接口启动另一个团队构建。该脚本工作正常,除非我尝试将shelveset添加到初始构建。在这种情况下,我收到以下错误:
Start-TargetBuild : Error in REST API call!
At \\chdfileserver01\IT\PowerShell_Library\TeamBuild-Launch.ps1:426 char:2
+ Start-TargetBuild
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : {"$id":"1","innerException":null,"message":"Value cannot be null.\r\nParameter name: build","typeName":"System.ArgumentNullException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561
934e089","typeKey":"ArgumentNullException","errorCode":0,"eventId":0}.ErrorDetails.Message,Start-TargetBuild
我错过了什么?
感谢。
答案 0 :(得分:1)
要使用shelveset触发构建,您应该在REST API正文中使用 sourceBranch 参数。
sourceBranch: "The shelveset name","The shelveset owner"
答案 1 :(得分:0)
作为参考,全身json应该是:
$body = '
{
"definition": {
"id": 10000
},
"sourceBranch": "ShelvesetName;Domain\\UserName"
}
'