cybersnow1989
cybersnow1989

Reputation: 331

In Azure Release Pipelines is it possible to manually trigger multiple release pipelines at once?

In our organization we have each repo set up with a complete pipeline (build in yaml and release using the ui which we have to do to use deployment groups). We have to keep the repos separate via pipelines as we often do a release just for that service, sometimes however we are releasing several services at once (this is known way in advance of the release).

Currently we just have the list of release pipelines to run and we run each one manually.

I was wondering if there was a way to setup something so that multiple release pipelines can be run off one click after the initial setup?

Below are the steps id ideally like to take:

  1. Determine which pipelines need to be released (this usually happens before the sprint in a planning meeting)
  2. Create "something" (another release pipeline that is only used for this release, another azure option I'm unaware of) that basically brings all the release pipelines that need to be included in one place.
  3. Trigger all the release pipelines so they run (as if I ran each one manually)

Upvotes: 1

Views: 963

Answers (2)

Hugh Lin
Hugh Lin

Reputation: 19371

As another workaround, you could add a PowerShell task to create multiple releases for different release definition by REST API.

POST https://vsrm.dev.azure.com/{organization}/{project}/_apis/release/releases?api-version=5.0

Sample powershell script to create releases as below:

#Define the variable and enter the release definition id that you want to trigger. For example, I want to manually trigger release pipelines 1 and 2 at once.

$ReleaseDefinitionID = 1,2

ForEach ($ID in $ReleaseDefinitionID)
{
Write-host "ID is" $ID

$token = "pat"   
$url = "https://vsrm.dev.azure.com/{organization}/{project}/_apis/Release/releases?api-version=5.0"
$token = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$($token)"))


$JSON = @"
{
  "definitionId": $ID
}
"@

$response = Invoke-RestMethod -Uri $url -Headers @{Authorization = "Basic $token"} -Method Post -ContentType application/json -body $JSON

}

Upvotes: 0

Krzysztof Madej
Krzysztof Madej

Reputation: 40563

You may use Trigger Azure DevOps Pipeline and then create another pipeline:

enter image description here

You can create a variable for each release to indicate which version of artifact you want to deploy.

enter image description here

In that way all what you need is to edit variables before running this release once you define it.

Upvotes: 1

Related Questions