Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure DevOps Build Submodule

I have a private bitbucket repo that is connected to the Azure DevOps Build Pipeline. The private repo has a submodule connected to a public Github repo.

Both repositories are accessed via SSH.

I have ticked the clone submodules box in DevOps.

How do I provide an SSH key to Azure DevOps so it will clone the submodule?

like image 292
Dean Marcussen Avatar asked Sep 14 '18 07:09

Dean Marcussen


People also ask

What is the purpose of submodules?

Git submodules allow you to keep a git repository as a subdirectory of another git repository. Git submodules are simply a reference to another repository at a particular snapshot in time. Git submodules enable a Git repository to incorporate and track version history of external code.

What is submodule init?

The git submodule init command creates the local configuration file for the submodules, if this configuration does not exist. # add submodule and define the master branch as the one you want to track git submodule add -b master [URL to Git repo] git submodule init.

When should you use submodules?

In most cases, Git submodules are used when your project becomes more complex, and while your project depends on the main Git repository, you might want to keep their change history separate. Using the above as an example, the Room repository depends on the House repository, but they operate separately.


1 Answers

The solution for this was not to change to https, or setup a self hosted agent.

There is a step available called Load an SSH key.

I created a new ssh key on github, added the Load SSH Key step to the VSTS tasks.

It runs before the Checkout task (despite appearing in the queue afterwards) and loads the required ssh key on the agent

like image 161
Dean Marcussen Avatar answered Sep 29 '22 06:09

Dean Marcussen