Pipeline resource triggers doesn't consider branch

Viewed 22

I've two Azure DevOps CI pipelines

  1. DataPipeline\Windows - Build
  2. DataPipeline\TestPipeline

The second pipeline is a pipeline resource trigger. I've used this doc as a reference.

When a pull request is created (e.g. with dev branch as source branch and main branch as target branch, not merged yet) both these pipelines are triggered (by default configuration). The second pipeline may pick up old artefacts (this is a different part altogether). A second run for pipeline DataPipeline\TestPipeline is triggered automatically as soon as DataPipeline\Windows - Build completes for a commit in the dev branch. Is this possible? I've specified the branch name in the resources trigger. Is something wrong with the YAML configuration? My expected behaviour is when a pull request is created for branch name: xyz (not main), DataPipeline\TestPipeline shouldn't be triggered again after DataPipeline\Windows - Build completes.

DataPipeline\TestPipeline.yml

 trigger: none
    resources:
      pipelines:
      - pipeline: DataPipeline
        source: 'DataPipeline\Windows - Build'
        branch: main
        trigger:
           branches:
             include:
             - main
    
    name: TestPipeline_$(variable)
    
    jobs:
    // template based job
0 Answers
Related