Home > Enterprise >  Run two stages in Azure DevOps Pipeline "partially" parallel
Run two stages in Azure DevOps Pipeline "partially" parallel

Time:09-27

I have two stages in my Azure DevOps pipeline. One with Pulumi Preview (let's call it Preview) and one with Pulumi Up (Up) in order to run my infrastructure as code.

Both run from the same container and it takes a while to pull it. I want to manually approve the Preview before the implementation.

Can I pull and run the container for both stages simultaneously but wait for the last job of the UP-Stage until the Preview-Stage is approved?

Currently they depend on eachother as follows:

trigger:
- master

pool:
  vmImage: 'ubuntu-latest'

stages:
- stage: Pulumi_Preview
 jobs:   
  - job: Preview
    container:
      image: REGISTRY.azurecr.io/REPOSITORY:latest
      endpoint: ServiceConnection
    steps:
    - task: Pulumi@1
      displayName: pulumi preview
      inputs:
        azureSubscription: 'Something'
        command: 'preview'
        args: '--diff --show-config --show-reads --show-replacement-steps'
        stack: $(pulumiStackShort)
        cwd: "./"

- stage: Pulumi_Up
  displayName: "Pulumi (Up)"
  dependsOn: Pulumi_Preview
  jobs:
  - job: Up
    container:
      image: REGISTRY.azurecr.io/REPOSITORY:latest
      endpoint: ServiceConnection
    steps:
    - task: Pulumi@1
      inputs:
        azureSubscription: 'Something'
        command: 'up'
        args: "--yes --skip-preview"
        stack: $(pulumiStackShort)
        cwd: "./"

CodePudding user response:

You could use the Manual Validation Task.

Use this task in a YAML pipeline to pause a run within a stage, typically to perform some manual actions or validations, and then resume/reject the run.

jobs:
  - job: waitForValidation
    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: 'resume'
  • Related