retroman
retroman

Reputation: 195

Azure pipelines triggers 2 jobs per pull request

When I create a pipeline PR trigger against master I always get two jobs being created:

One job says : "Individual CI for" the other job says : "PR automated for"

One job is always queued behind the other and the PR waits for both of them to be run which is annoying because it doubles the build time. Why are two jobs spawned? Is this a bug in Azure DevOps pipelines? Any idea how I can fix it?

My YAML file:

pr:
- master

Upvotes: 7

Views: 2341

Answers (2)

atconway
atconway

Reputation: 21304

This also depends on the actual trigger you desire to kick off your pipeline, so I use a modified version of the accepted answer. I want the pipeline to trigger off any changes to master but not on every single PR. Without setting the pr configuration, there would be 2 builds for each merged PR to master. The following combination ensures a single build:

trigger:
- master
pr:
- none

Do realize this is intentional on my behalf, and others may want PRs to trigger their own builds as well. The purpose here is to show you these 2 individual configurations being set as desired will choose which scenario kicks off the build.

pr definition

Upvotes: 2

Cece Dong - MSFT
Cece Dong - MSFT

Reputation: 31013

YAML pipelines are configured by default with a CI trigger on all branches. You can opt out of CI triggers entirely by specifying trigger: none:

trigger:
  - none

https://learn.microsoft.com/en-us/azure/devops/pipelines/repos/azure-repos-git?view=azure-devops&tabs=yaml#disabling-the-ci-trigger

Upvotes: 12

Related Questions