Azure DevOps Pipeline stage filter issue

Viewed 115

Context:

I have two pipelines. Let's call them trigger and trigger-two.

Trigger pipeline has multiple stages, called Troubleshooting, Troubleshooting2, and Troubleshooting3.

My aim is to trigger trigger-two pipeline when the stages Troubleshooting and Troubleshooting2 from trigger pipeline are completed.

Issue:

I have followed Microsoft documentation ( https://docs.microsoft.com/en-us/azure/devops/pipelines/process/pipeline-triggers?view=azure-devops ), but no matter how I implement it, the trigger-two pipeline is triggered only when the trigger pipeline is fully completed. The stage filter is not taken into consideration for unknown reasons.

Code for the trigger-two pipeline:

trigger: none

resources:
  pipelines:
  - pipeline: triggertest  
    source: triggertest
    project: project_name
    trigger:
      stages:
        - Troubleshooting
        - Troubleshooting2
      branches:
        include:
          - refs/heads/branchtest
1 Answers

I tried to reproduce the issue, but it works in my pipeline. Please try my my yaml:

pipeline trigger:

trigger:
- none

pool:
  vmImage: windows-latest

stages:
- stage: Troubleshooting1
  jobs:
  - job: Troubleshooting1
    steps:
    - task: PowerShell@2
      inputs:
        targetType: 'inline'
        script: |
          Write-Host "Hello World"
- stage: Troubleshooting2
  jobs:
  - job: Troubleshooting2
    steps:
    - task: PowerShell@2
      inputs:
        targetType: 'inline'
        script: |
          Write-Host "Hello World"
- stage: Troubleshooting3
  jobs:
  - job: Troubleshooting3
    steps:
    - task: PowerShell@2
      inputs:
        targetType: 'inline'
        script: |
          # Write your PowerShell commands here.
          Write-Host "Hello World" 
          #in order to add the time for this stage, install a Module 
          Install-Module Az -Scope CurrentUser -Force

Pipeline trigger-two:

trigger: none

resources:
  pipelines:
  - pipeline: trigger-resource  
    source: trigger
    project: testproject
    trigger:
      stages:
        - Troubleshooting1
        - Troubleshooting2
      branches:
        include:
          - refs/heads/main

pool: Default # Specify a self hosted agent pool by name. Because I only have one MS-hosted agent parallel job. So I use different pool in two yaml.
#pool:
#  vmImage: windows-latest
steps:
- task: CmdLine@2
  inputs:
    script: |
      echo Write your commands here
      echo Hello world

enter image description here

Edit:

enter image description here

Related