Please provide azure pipeline yml code to pause a PR build stage until two approvals are…
- User
Please provide azure pipeline yml code to pause a PR build stage until two approvals are received for the pull request
Assistant
Here is an azure-pipelines.yml code snippet to pause a PR build stage until two approvals are received:
# PR build stage stages: - stage: PR_build jobs: - job: PR_build_job pool: vmImage: 'ubuntu-16.04' steps: - script: echo Building PR... # Pause stage until 2 approvals - approval: 2 displayName: Wait for 2 approvals # Resume after approvals - script: echo Continuing build after approvals... displayName: Build after approvalsThis will:
- Define a PR_build stage with one job
- The job will start and print a message
- Then it will pause with a approval gate requiring 2 approvals
- Once 2 approvals are received on the PR, the build will resume
- It will print a message and continue the rest of the build
So this ensures your PR build stage waits for the required number of approvals before proceeding with the build. Let me know if you have any other questions!