a3y3
a3y3

Reputation: 1191

Manual approvals for stages in Azure Devops pipelines (YAML)

I have a stage that uses 6 deployment jobs that can either deploy to dev, staging or production depending on specific conditions.

For deploying to production, I'd like to add manual approvals. I am aware that deployment jobs can specify environments on which you can add manual approvals, but I'd like to approve the entire stage and not each individual deployment job. This way, I can approve the stage once and all 6 deployment jobs can run at once, instead of having to approve 6 times.

Is this possible? The documentation says it should be, but it doesn't say how. Besides, in the YAML schema for stages, it doesn't look like you can specify environments inside stages.

Upvotes: 3

Views: 5889

Answers (2)

Ian
Ian

Reputation: 3149

Looks like the ManualValidation task could help you there. Using dependsOn will allow all other jobs to complete before final approval.

Example:

jobs:  
  - job: waitForValidation
    dependsOn: 'previousJobName'
    displayName: Wait for external validation  
    pool: server    
    timeoutInMinutes: 4320 # job times out in 3 days
    steps:   
    - task: ManualValidation@0
      timeoutInMinutes: 1440 # task times out in 1 day
      inputs:
        notifyUsers: |
          [email protected]
          [email protected]
        instructions: 'Please validate the build configuration and resume'
        onTimeout: 'reject'

Upvotes: 6

Andy Li-MSFT
Andy Li-MSFT

Reputation: 30362

Currently there is no such a built-in feature to approve entire stage in YAML. We can only Define approvals and checks for the environments. The documentation you mentioned is also indicated that this is commonly used to control deployments to production environments.

However, there's already a suggestion ticket to request the feature. You could vote and add your comments for the suggestion ticket to achieve that in future release.

Upvotes: 3

Related Questions