Powershell 通过传递不同的VariableGroup,在多个时间安排Azure devops发布
我可以通过使用下面的脚本来安排一个多时间版本Powershell 通过传递不同的VariableGroup,在多个时间安排Azure devops发布,powershell,azure-devops,azure-pipelines,azure-pipelines-release-pipeline,Powershell,Azure Devops,Azure Pipelines,Azure Pipelines Release Pipeline,我可以通过使用下面的脚本来安排一个多时间版本 $timinglist=@(1:30,2:30,3:30) $PATtoken= 'PAT' Write-Host "Initialize Autnetication COntext" -ForegroundColor DarkBlue $token = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes("
$timinglist=@(1:30,2:30,3:30)
$PATtoken= 'PAT'
Write-Host "Initialize Autnetication COntext" -ForegroundColor DarkBlue
$token = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$($PATtoken)"))
$header=@{authorization= "Basic $token" }
$defurl = "https://vsrm.dev.azure.com/Organization/Project/_apis/release/definitions/13?api-version=5.1"
$definition = Invoke-RestMethod -Uri $defurl -Method Get -Headers $header
$hash = @(
@{
triggerType="schedule";
schedule = @{"daysToRelease"="31";"timeZoneId"="India Standard Time";"startHours"=01;"startMinutes"=30}
}),
@{
triggerType="schedule";
schedule = @{"daysToRelease"="31";"timeZoneId"="India Standard Time";"startHours"=02;"startMinutes"=30}
}),
@{
triggerType="schedule";
schedule = @{"daysToRelease"="31";"timeZoneId"="India Standard Time";"startHours"=03;"startMinutes"=30}
})
$definition.triggers = $hash
$definition.variableGroups=@(10,11,12)
$json = @($definition) | ConvertTo-Json -Depth 99
$updatedef = Invoke-RestMethod -Uri $defurl -Method Put -Body $json -ContentType "application/json" -Headers $header
Write-Host ($updatedef.triggers | ConvertTo-Json -Depth 99)
我可以将变量组作为$definition传递。variableGroups=@(10,11,12)。在这里,变量组10、11和12将通过这三个版本中的每一个
唯一的变量组10在01:30发布,变量组12在02:30发布,变量组11在03:30发布。是否可以使用任务组、环境和变量组来完成此任务 您定义了一个任务组,其中包含要重用的操作
在单个版本中,您可以在许多不同的阶段使用该任务组。每个发布阶段都可以绑定到不同的任务组。然后您只需调用REST API来触发正确阶段的部署。没有获取最新信息,解决方法对您有帮助吗?或者如果你有任何问题,请在这里分享。