我正在使用版本4.1-preview.6来调用VSTS的Release API,看起来每当它创建一个新版本时,该版本的标题将不是预期的标题,“Release-#”而是像“-1”这样的负数。我正在使用PowerShell。我可以在Web UI中看到版本名称格式为$(Build.BuildNumber)-$(rev:r)
。
请求正文(不包括脚本中先前设置的变量和Invoke-RestMethod的函数):
$uri = "https://$($accountName).vsrm.visualstudio.com/$($projectName)/_apis/release/releases?api-version=4.1-preview.6"
$body = @{
"definitionId" = "$($releaseDefinitionId)"
"description" = "Creating automated release"
}
$body.Add("artifacts", @())
$artifact = @{
"alias" = "$($buildDefinitionName)"
"instanceReference" = @{
"id" = "$($buildId)"
"name" = $null
}
}
$body.artifacts += $artifact
$jsonBody = $body | ConvertTo-Json -Depth 5
$response = Invoke-RestCommand -uri $uri -commandType "POST" -jsonBody $jsonBody -personalAccessToken $personalAccessToken
响应:
id : 4
name : -4
status : active
createdOn : 2018-06-12T04:27:18.237Z
modifiedOn : 2018-06-12T04:27:18.237Z