Pshymonz
Pshymonz

Reputation: 1

How did approvals change for piplines?

So previously when a pipeline has been run it only needed one approval when the pipeline was running but now it seems that at every stage an approval is needed. I know that now in the 'environments' approvals & checks part you can add an approval, but I was just asking if anything had changed within Azure Devops.

This is not applicable.

Upvotes: 0

Views: 33

Answers (1)

Bright Ran-MSFT
Bright Ran-MSFT

Reputation: 13919

In Azure Pipelines, the checks (Approvals & Checks) are evaluated at stage-level. No option to let checks be evaluated at pipeline-level.

If you set some checks on an environment at the 'Environments' section, in YAML pipelines, the checks will be evaluated on each of the stages which are using the environment.

If you want to have only one approval prompt in every pipeline run, you can try to use the ManualValidation@0 task in your YAML pipeline:

  1. Remove all the approvals set on the environments and other resources that will be used in the pipeline.

  2. Add stage as the very first one in the pipeline to run the ManualValidation@0 task in a Server job (Agentless job). And set other subsequent stages to depend on the first stage.

# azure-pipelines.yml

stages:
- stage: approval
  jobs:
  - job: approval
    pool: server
    timeoutInMinutes: 4320
    steps:
    - task: ManualValidation@0
      displayName: 'Need approvals'
      timeoutInMinutes: 1440
      inputs:
        notifyUsers: |
          [email protected]
          [email protected]
        instructions: 'Please validate and approve this run.'
        onTimeout: reject

- stage: A
  dependsOn: approval
  jobs:
  - job: A1
  . . .

- stage: B
  dependsOn: approval
  jobs:
  - job: B1
    . . .

enter image description here


Upvotes: 0

Related Questions