1
votes

enter image description here

I have a build/release pipeline created using yaml as shown in the above image.First is 'Build_Service'. 'Deploy_service_ar', 'Deploy_service_gh', 'Deploy_service_pd', 'Deploy_service_lp', 'Deploy_service_st' depends on 'Build_Service'. I have added approval/check for each of these environments. For this particular build/release, I only want to deploy to 'pd' which it already completed. Although 'pd' deployment is complete, it is still waiting for approvals/checks in order to deploy to other environments. Since 'Manual only trigger' pre-deployment condition is not supported in yaml, is there an alternate way to cancel the build/cancel deployment to other environments automatically after completing deployment to pd? For instance, After waiting for approval check for ~10 hours, cancel build/cancel deployment to remaining environments automatically that are still waiting for approval? Please let me know.

1

1 Answers

1
votes

You can specify the conditions under which each stage runs. By default, a stage runs if it does not depend on any other stage, or if all of the stages that it depends on have completed and succeeded. You can customize this behavior by forcing a stage to run even if a previous stage fails or by specifying a custom condition.

stages:
- stage: A

# stage B runs if A fails
- stage: B
  condition: failed()

# stage C runs if B succeeds
- stage: C
  dependsOn:
  - A
  - B
  condition: succeeded('B')

More details please refer this doc--Conditions

Another way is using variable and powershell script to control your pipeline. For your reference: