除了通过API部署发行版外,我已经能够做所有事情。我已经搜索了所有文档,并且空着。我想念什么吗?
答案 0 :(得分:0)
截至目前,有两个端点可以触发管道和经典发行版。
请查看此发布操作:https://docs.microsoft.com/en-us/rest/api/azure/devops/release/releases?view=azure-devops-rest-5.1
答案 1 :(得分:0)
您可以使用create release rest api来部署新版本。
POST https://vsrm.dev.azure.com/{organization}/{project}/_apis/release/releases?api-version=5.1
请参阅以下Powershell脚本示例:
请参阅步骤here以获得个人访问令牌(PAT)。
$url = "https://vsrm.dev.azure.com/{organization}/{project}/_apis/release/releases?api-version=5.1"
$PAT= "Personal access token"
$base64AuthInfo= [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$($PAT)"))
$body= '{
"definitionId": 3
}'
$result=Invoke-RestMethod -Uri $url -Headers @{Authorization = ("Basic {0}" -f $base64AuthInfo)} -Method post -ContentType "application/json" -Body $body
如果要重新部署现有阶段。您可以使用update release environment rest api。
PATCH https://vsrm.dev.azure.com/{organization}/{project}/_apis/Release/releases/{releaseId}/environments/{environmentId}?api-version=5.1-preview.6
请参见下面的脚本示例:
$url = "https://vsrm.dev.azure.com/{organization}/{project}/_apis/Release/releases/{releaseId}/environments/{environmentId}?api-version=5.1-preview.6"
$PAT= "Personal access token"
$base64AuthInfo= [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$($PAT)"))
#set status to inProgress to redeploy the stage
$body= '{
"status": "inProgress"
}'
$result=Invoke-RestMethod -Uri $url -Headers @{Authorization = ("Basic {0}" -f $base64AuthInfo)} -Method patch -ContentType "application/json" -Body $body