Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure Devops YAML Pipeline Trigger on different repositories

Is it possible to have a yaml pipeline trigger on commits/PRs for branches of different repositories (e.g. Repo A) to the one the azure-pipelines.yaml file is in (e.g. Repo B)?

I'm aware I can build the pipeline against Repo B and have it checkout Repo A using e.g:

resources:
  repositories:
  - repository: Repo A
    type: github
    endpoint: ***
    name: ***/RepoA

trigger:
 - master

But the trigger is only applying to Repo B, i.e. when I make a commit on master to Repo A, the pipeline does not trigger.

like image 533
Dave Higgins Avatar asked Aug 05 '20 15:08

Dave Higgins


1 Answers

The "Sprint 173" release seems to be including the multi-repo triggers feature. I suspect you might be missing the ref.

Here is an example that shows how to define multiple repository resources in a pipeline and how to configure triggers on all of them.

trigger:
- main

resources:
  repositories:
  - repository: tools
    type: git
    name: MyProject/tools
    ref: main
    trigger:
      branches:
        include:
        - main
        - release

The pipeline in this example will be triggered if there are any updates to:

  • main branch in the self repo containing the YAML file
  • main or release branches in tools repo
like image 200
Matt Avatar answered Oct 23 '22 14:10

Matt