0
votes

I'm trying to trigger a deployment pipeline (YAML) from successful completion of a build pipeline (YAML) in Azure Devops. Our repository is on GitHub. I want the deploy pipeline to be triggered on the same branch as the build pipeline ran and to be triggered for all branches.

I have some requirements I need to add later around only triggering based on presence of a tag... but I think that will be a separate question because I cannot get my pipeline trigger to work under any circumstances!

To investigate, I have created a new blank repo with only 1 branch main. The build pipeline is called test-a and is manually triggered. The deploy pipeline is called test-b and I have put this resources section at the top:

resources:
  pipelines:
    - pipeline: 'test-a'
      source: 'test-a'
      trigger: true

test-a runs successfully. test-b gets triggered by the default CI trigger (for this proof of concept I removed the trigger: and pr: sections). But it doesn't get triggered by the pipeline trigger. Can anyone suggest anything please? We have a lot of pipelines so they are managed in folders - do I need to put the folder name in the pipeline source? I am clutching at straws now that my most basic test doesn't work!

Thanks

1
I have tried moving the pipelines so they aren't in a folder in devops. I've also tried adding branch: main simply because I've seen this in blog posts - the docs say it is not needed. Still no trigger happening unfortunately. - DaveBeta

1 Answers

0
votes

Pipeline Resource triggers are evaluated only on the default branch on manual and scheduled builds.

This is different from regular pipeline triggers that are evaluated on whatever branch they happen to be on.

To resolve this issue you need to do one of the two things.

  1. Merge your resource trigger changes into your default branch. Usually that's master or main.
  2. Configure your build's default branch to be the one that has the trigger in it. More docs here: https://docs.microsoft.com/en-us/azure/devops/pipelines/process/resources?view=azure-devops&tabs=schema#change-default-branch-for-triggers-optional