Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cross-repo branch policy build validation - how to?

So, Azure DevOps UI now supports setting up cross-repo policies to protect the default (master) branch for all existing and future repositories - nice!

Up until now we have used the same policy for each repository, manually setting it up whenever a new repository is added (we're doing microservices with a repository for each service). One of the policies is build validation. This is the only policy that changes from repo to repo because each repo has its own build pipeline (currently classic since YAML are still missing some key features) with a Git-trigger for the given repository.

The question is; if I set up cross-repo policies and want to include build validation, how do I do that given that each repo has its own build pipeline? AFAIK build pipelines does not (yet) support multiple repositories as triggers (this should be coming soon for YAML pipelines) so I can't create a single build pipeline to use for all repositories.

like image 521
Casper Avatar asked Dec 02 '19 20:12

Casper


Video Answer


1 Answers

Setting build validation in cross-repo policies does not apply to every repo . As you know, currently the build pipeline does not support multiple repositories as triggers. So if you want to trigger the build when the specified branch in each repo creates the pr, you need to add the pipeline of each repository to build validation, but this will cause all the branch policies need to pass if you want the pr to complete , and your other build pipelines in build validation is for other repositories, which will prevent the pr from completing. As shown below:

enter image description hereenter image description here

Build validation set in cross-repo policies is required to be followed by each specified branch.

So, for now, if you want the build pipeline of each repository to be triggered , you need to set build validation separately in the branch policy of each repository.

like image 56
Hugh Lin Avatar answered Oct 19 '22 06:10

Hugh Lin