Azure DevOps Yaml Pipeline Build Validation Across Multiple Repos

Copper Contributor

I have multiple repos that are configured the same way for unit tests. (repo1, repo2, repo3). I then have a separate repo that includes the infrastructure for the tests (repo-tests). It has a docker-compose file, set's all the needed environment variables, image, etc. I can clone down all 4 repos, specify the repo that I want to test and run the docker-compose up and it does all the unit tests. 

What I'm trying to do is build out a Yaml build pipeline in ADO and save the code for the pipeline in repo-tests. I then want to setup a branch policy for repo1, repo2, and repo3, setting this pipeline as a "Build Validation" so that it will trigger on Pull Requests and run the tests. I have tested this out and I'm not having much luck. It shows up in the PR, but shows as "not run" with a "Queue" button that doesn't seem to do anything. 

Here is the code:

  - repository: repo1
    type: git
    name: Project/repo1
    - main
  - repository: repo2
    type: git
    name: Project/repo2
    - main  
  - repository: repo3
    type: git
    name: Project/repo3    
    - main

name: $(date:yyyyMMdd)$(rev:.r)
  name: Agent-Pool-1

- checkout: self
- checkout: repo1
- checkout: repo2
- checkout: repo3

- task: CmdLine@2
  displayName: Run Tests
    script: echo running tests

Is what I'm looking to do even possible? Or do I have to create 3 different pipelines for each repo to accomplish this? Thanks for the help!

1 Reply

For anyone else who might have this issue, the problem for me was that I was testing the pipeline code from a new branch. Once the code was merged into master, it worked fine.