Search code examples
azure-devopsazure-devops-pipelines

Azure Pipelines environments approvals


I have set up 2 environments and protected only one environment.

However pipeline run expect me to approve even before it starts.

I am assuming that Build and DevEnv deployment should happen un attended and should stop for QAEnv alone. Am I missing anything?

enter image description here

enter image description here

enter image description here


Solution

  • Agree with Daniel Mann.

    You could split the jobs into two stages (Dev stage and QA stage).

    Here is an example:

    stages:
    - stage: Dev_Stage
      jobs:
      - deployment: DeployWeb
        displayName: deploy Web App
        pool:
          vmImage: 'Ubuntu-latest'
        environment: 'env1'
        strategy:
          runOnce:
            deploy:
              steps:
              - script: echo Hello world
    
    - stage: QA_Stage
      jobs:
      - deployment: DeployWeb
        displayName: deploy Web App
        pool:
          vmImage: 'Ubuntu-latest'
        environment: 'env2'
        strategy:
          runOnce:
            deploy:
              steps:
              - script: echo Hello world
    

    Result:

    enter image description here

    In this case, the stage1 has no check steps , the stage2 needs to be checked.

    If you set the environment for the two stages separately, the two stages are independent of each other, they will not interfere with the other stage.

    Hope this helps.