Thursday 5 December 2019

Building Code from Multiple Repos with YAML Pipelines

You could only build code from a single repo using classic build pipelines in Azure DevOps. Now with multiple repo support added to YAML build pipelines (pipeline as code), you can decide which of the repos you want to checkout and build, in a single pipeline build sequence. Let’s see the steps in detail.

First, to understand how it works add couple of repos to a team project and add some code to each repo. In this example, you can find three repos defined in the team project MultiRepoBuild, namely MultiRepoBuild, multiRepo1 and multirepo2.

In each repo, a .NET Core Web App is added.

In one of the repos, you can define the YAML pipeline.

As the build pipeline code is added to the MultiRepoBuild repo, we need to refer the other two repos in the YAML definition. This can be done with the syntax shown below.

Then, you can define checkout steps. Checkout self says to checkout the MultiRepoBuild repo, as it is the repo containing the YAML pipeline code. The other two repos are checked out with specifying their names.

You can add a step to view the content of the build source directory, which will show the three repos available in the build source directory as three folders.

Then we can use build steps to build projects from each repo.

The full pipeline code is shown below.

The pipeline executes and builds code from multiple repos.

No comments:

Popular Posts