Bitbucket Pipelines is a great deployment tool tightly integrated into Bitbucket. It allows you to trigger deployments directly from repository branches and tags, and you can customize your deployment steps as needed.

One missing feature in Pipelines is that it is not able to automatically clone submodules that are added to your repository as this requires some additional settings. Until this feature gets added by default, there is a simple way to achieve this.

First, we need to make sure our repository has access to clone the sub-modules repository. You can configure this by reading Cloning another Bitbucket repository in Bitbucket Pipelines.

Next, the git submodule update --init --recursive command can initialize, fetch and checkout any nested submodules. Add it to the beginning of the script block.

    - step:
          - git submodule update --init --recursive

The above Pipeline checks out all nested submodules during its execution. We can then use them in subsequent build steps.

Deploying git submodules in Bitbucket Pipelines
Enlargeโ€” Deploying git submodules in Bitbucket Pipelines