3
votes

right now I have configured multiple pipelines, each pipeline has its own tasks and variables. To deploy all I need to manually deploy one by one.

Is it possible to create a pipeline that triggers other pipelines to combine my release definition so I could trigger all with single click ?

2
Do you want to trigger multiple releases from different release definitions/pipelines? Or do you want to deploy multiple environments in a release definition/pipeline (as Jayendran suggests)?Marina Liu
@MarinaLiu-MSFT what I want is to trigger multiple pipelines definition to single enviroment, lets say I have 10 microsevices, for each it's own pipeline definition so to release all to dev I have to trigger 10 times, what I want is to combine them into single click. but how?kosnkov
I added answer for how to achieve it, you can have a try.Marina Liu

2 Answers

2
votes

To create multiple releases for multiple release definitions, you can add PowerShell task to create releases for different release definition by REST API.

The PowerShell script to create a release as below:

$body = '
{
    "definitionId": releasedefinitionID,
     "artifacts": [
        {

      "alias": "",
      "instanceReference": {
        "id": "buildID",
        "name": null
      }

        }
    ]
}
'
$bodyJson=$body | ConvertFrom-Json
Write-Output $bodyJson
$bodyString=$bodyJson | ConvertTo-Json -Depth 100
Write-Output $bodyString
$user="name"
$token="PAT"
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $user,$token)))

$Uri = "https://account.vsrm.visualstudio.com/project/_apis/Release/releases?api-version=4.1-preview.6"
$buildresponse = Invoke-RestMethod -Method Post -UseDefaultCredentials -ContentType application/json -Uri $Uri -Body $bodyString -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)}
write-host $buildresponse
1
votes

Yes, You can. There is an option in the release pipeline called the Predeployment condition within there is a menu called trigger, where you can change/control the trigger type.

Typically looks like below

enter image description here

Update 1

In order to deploy multiple environment parallel, change your trigger option from after environment to after release

enter image description here