We’ve recently faced an issue when deploying a repository containing submodules while using Code Pipeline. First, let’s understand how Code Pipeline pulls data from Github.

Let’s say we have a very simple deployment process like this:

1- CodePipeline pulls a specific branch from a repository
2- CodeBuild receives the files and the build/compiling process happens with a buildspec.yml file.

Image for post
Image for post

OK, so ideally what we would do is simply run git submodules init and git submodules update --recursive in our buildspec.yml file and it should be all set, right?

Not really. When CodePipeline pulls the files from your repository and passes to CodeBuild, it actually doesn’t include the .git directory, that being said, we can’t perform any Git actions because it is no longer is a Git repository. …

About

Cristiano Ventura

I’m a Software Engineer, and here I share some of the things I learn on a daily basis.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store