Forum Discussion
Azure DevOps Yaml Pipeline Build Validation Across Multiple Repos
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:
resources:
repositories:
- repository: repo1
type: git
name: Project/repo1
trigger:
- main
- repository: repo2
type: git
name: Project/repo2
trigger:
- main
- repository: repo3
type: git
name: Project/repo3
trigger:
- main
name: $(date:yyyyMMdd)$(rev:.r)
pool:
name: Agent-Pool-1
steps:
- checkout: self
- checkout: repo1
- checkout: repo2
- checkout: repo3
- task: CmdLine@2
displayName: Run Tests
inputs:
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!
4 Replies
- garretwymanCopper Contributor
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.
- yassakaCopper Contributor
however , when i move the same yaml to the main branch of repo b it works fine
did you confirm that azure devops only triggers build validation automatically when the pipeline yaml is in the default branch of the repo containing the pipeline or if you some documentation how explain that because i search but if found nothing
- yassakaCopper Contributor
i have a build validation configured on a branch repo a , but the yaml pipeline is stored in another repo b , when the yaml is in feature branch , the pr shows one required check not yet run and the build never starts
- yassakaCopper Contributor
hi im facing a similar issue