Clone Submodules
This tutorial explains how to clone submodules in build job
Clone via HTTP(s) Protocol
If submodules are defined to clone via HTTP(s) protocol:
-
Create an access token with read code permission to main project and all submodule projects:

-
Edit build setting of the main project to define a job secret with value set to access token created above:

-
Configure checkout step of the job to specify clone credential as HTTP(S), and select job secret created above as access token secret. Also make sure to tick the option Retrieve Submodules:

Clone via SSH Protocol
If submodules are defined to clone via SSH protocol:
-
Make sure submodule repositories are referenced using same
hostas specified inSSH root urlin system setting -
Make sure you can clone submodules locally in your terminal. To make it working, you will need to add public key (normally content of file ~/.ssh/id_rsa.pub) to your account and make sure your account has permission to pull submodule projects

-
Edit build setting of the main project to define a job secret containing your private key (normally content of file ~/.ssh/id_rsa)

-
Configure checkout step of the job to specify clone credential as SSH, and select job secret created above as key secret. Also make sure to tick the option Retrieve Submodules:
