简体   繁体   中英

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.

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.

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: |
          test@test.com
          example@example.com
        instructions: 'Please validate the build configuration and resume'
        onTimeout: 'reject'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM