App Platform: Handling GitLab submodules

App Platform, DigitalOcean, GitLab

Git submodules are a bit of a pain; that said we are iterating on this and trying to make it better in the future. I do have a workaround that will hopefully handle your needs:

This assumes that your submodule is hosted in the same account/team as your app repository.

When an app is created from a GitLab project, we create and assign a deploy key to that project. Our build system uses that deploy key to check out the repository code as well as all submodule repositories. This means we need to enable that deploy key on the submodules repository.

Get the deploy key UUID from the app repository by going to the project, then

1. Settings
2. Repository
3. Deploy Keys
4. Copy the deploy key name (it’s a UUID)
5. then go to the submodule repository, and
1. Settings
2. Repository
3. Deploy Keys
4. Privately accessible deploy keys
5. Search for the deploy key matching the UUID copied from the above
   step and click Enable.

You will also need to use the git ssh URL instead of the git https url in your .gitmodules file. So [email protected]:owner/repo.git instead of https://gitlab.com/owner/repo.git.