Home > Back-end >  Azure Pipelines: 2 build are triggered for PR
Azure Pipelines: 2 build are triggered for PR

Time:02-23

I'm using Azure DevOps yaml pipelines. Whenever I push to a branch that has an open pull request, 2 builds are triggered: One with the name of the PR, the other with the name of the commit, see

enter image description here

The trigger section in both, source and target branch, is equal:

trigger:
  branches:
    include:
      - "*"
# builds is already triggered once by branch
pr: none

How can I avoid triggering 2 builds for the same commit using the same (branched) pipeline.yaml in both branches?

CodePudding user response:

This is due to CI trigger on your branch and PR build validation policy running the pipeline automatically.

To avoid that either

  1. In the build validation policy - disable automatic queuing.
  2. Or mark the PR as draft, while changes are being worked on.

After this change any of the changes will only trigger CI build/pipeline, and when ready just publish the PR or queue the PR manually

  • Related