How can I trigger a specific stage in azure release pipeline according to the build configuration in build pipeline

Viewed 39

In my selenium automation suite I have different config files for different environments. (App.Dev.config, App.QA.config likewise). Currently I have two azure pipelines one build pipeline and a release pipeline. So if I want to run the UI automation tests in QA environment what I do now is change the buildconfiguration variable in build pipeline to 'QA' run the build pipeline and then once it is success run the QA stage in release pipeline manually. Is there a way to trigger this automatically?

1 Answers

Install the trigger release extension: Release Orchestrator :https://marketplace.visualstudio.com/items?itemName=dmitryserbin.release-orchestrator&targetId=ca4e4e67-3099-4c62-9ea9-bef80e0cc70a&utm_source=vstsproduct&utm_medium=ExtHubManageList

enter image description here

Set variable in your build pipeline:

- task: PowerShell@2
  inputs:
    targetType: 'inline'
    script: 'echo "##vso[task.setvariable variable=doThing]QA"'

Use the release Orchestrator task in your build pipeline to trigger the wanted stage in your release pipeline with conditions:

- task: releaseorchestrator@2
  inputs:
    endpointType: 'integrated'
    projectName: '{ProjectName}'
    definitionName: 'TestReleaseExtension'
    releaseStrategy: 'create'
    definitionStage: 'Stage 2'
    approvalRetry: 60
    updateInterval: 5
  condition: eq(variables['doThing'], 'QA')

enter image description here

enter image description here

Make sure the Build Service Account has the permission to create releases.

enter image description here

Related