Jan Wicher
Jan Wicher

Reputation: 301

Azure DevOps pipeline trigger does not fire

Problem

Azure DevOps has a feature (documented here) to trigger a pipeline on completion from another pipeline. This works fine in a test organization, but it won't work in our main organization. There could be something on the organization, project, repository or even branching level, but I'm currently stuck and any help would be appreciated!

Pipelines

Pipeline Pipeline B should run automatically when pipeline Pipeline A completes.

File pipeline-a.yaml for Pipeline A:

pool:
  vmImage: 'ubuntu-latest'

steps:
- script: echo Hello, world!
  displayName: 'Do something'

File pipeline-b.yaml for Pipeline B:

trigger: none

pool:
  vmImage: 'ubuntu-latest'

resources: 
  pipelines:
  - pipeline: pipeline-a
    source: 'Pipeline A'
    branch: master
    trigger: 
      branches:
      - master

steps:
- script: echo Hello, world!
  displayName: 'Do something'

Organizations

In my test organization the above pipelines run like a charm. This means that Pipeline A runs on a commit, and after completion, Pipeline B runs automatically.

Yet in our production organization, Pipeline B does not run automatically.

Discovery

Upvotes: 11

Views: 5483

Answers (3)

Giles Roberts
Giles Roberts

Reputation: 6883

In my case it was as simple as the source pipeline completing with an error. Testing with a very simple non erroring pipeline and the code worked fine.

Upvotes: -1

Eric Smith
Eric Smith

Reputation: 2560

We troubleshot a similar problem today. With Pipeline-A defined as a resource that is meant to be consumed by Pipeline-B.

The consuming pipeline was never being triggered. Deleting and recreating the pipeline did not work for us. This work\pipeline was net new and on a feature branch. That ended up being important.

The ultimate fix was defining that feature branch as the Default branch for manual and scheduled builds in Pipeline-B. You can find that setting tucked away in Pipeline -> Edit -> triggers -> yaml-> Get Sources. Expect that as we promote this code to the main branch we will need to update the setting.

So it seems like the Default branch for manual and scheduled builds would be better named

Default branch for manual and scheduled builds and Pipeline Completion Triggers

Upvotes: 8

Jan Wicher
Jan Wicher

Reputation: 301

Deleting and re-adding the pipeline did the trick. So keep the YAML file but delete the pipeline and add it again.

The Azure DevOps backend seems to miss a relationship between pipelines now and then.

Upvotes: 9

Related Questions