How to clone multiple repositories in a single pipeline || Azure DevOps

Chandrapurnima Bhatnagar
2 min readNov 21, 2022

If you have a common library or set of scripts or tasks that are being used across the pipelines in a different project, this article is for you.

Collect all your common tasks/scripts and develop a common utility. The best way is to create separate repository so that you can maintain versions of your library.

Now that you have a library create how to import it in multiple Azure DevOps pipeline.

Use Resources: Add common utility as a reference in your pipeline definition.

YAML pipeline snippet

Checkout the reference resource and source explicitly. Both will be clones at ‘$(System.DefaultWorkingDirectory)’

checkout utils

When you run the pipeline, you will be asked to grant permission to repository.

Once you allow and pipeline runs, you can verify that resources used in a pipeline on the run summary.

Resources object in pipeline supports multiple resource elements such as repository, pipeline,

Ref doc : About pipeline resources — Azure Pipelines | Microsoft Learn

--

--