Yoda
Yoda

Reputation: 18068

Can I trigger a release after the other release?

I've got a deployment release (A) and E2E test run release (B). I cannot merge them. Can I somehow set B release run after given stage in A release completes?

Upvotes: 2

Views: 1236

Answers (2)

Kevin Lu-MSFT
Kevin Lu-MSFT

Reputation: 35119

Agree with Shayki Abramczyk.

I would like to share the Powershell script sample and other extensions.

Powershell script to trigger the release:

Here is the powershell script example:

$VSTSAccoutName="organiztionname"   
$teamProjectName="projectname"
$personaltoken = " PAT "
$ReleaseMetadata = '{"definitionId":  15  }';
 
$token = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$($personaltoken)"))
$header = @{authorization = "Basic $token"}
$Uri = 'https://vsrm.dev.azure.com/' + $VSTSAccoutName +'/'+ $teamProjectName + '/_apis/release/releases?api-version=5.0'
$ReleaseResponse = Invoke-RestMethod -Method Post -ContentType application/json -Uri $Uri -Body $ReleaseMetadata -Headers $header
Write-Host $ReleaseResponse 

You could add the powershell task in the Release A -> Target stage.

Other extensions: Release Orchestrator extension

enter image description here

This extension also supports selecting to trigger the stages specified in release B.

Upvotes: 4

Shayki Abramczyk
Shayki Abramczyk

Reputation: 41545

You can use the VSTS Creare Release Task extension:

Creates a new release as part of the current release pipeline.

enter image description here

So, add it in the last step of deployment release (A).

Upvotes: 2

Related Questions