Checking out submodules recursively with gitlab ci
I have created a example Gitlab project. In this project I have added a .gitmodules that references another project on my Gitlab's group.
I am using the GIT_SUBMODULE_STRATEGY: recursive
in the .gitlab-ci.yml as suggested in the gitlab CI documentation
But when this gitlab job is triggered the sub modules do not get downloaded to the jobs folder.
I have check to ensure that my sub module project has files "ThisFileIsFromCASModbusStack.txt" and is checked in to master.
I have tried several variants of GIT_SUBMODULE_STRATEGY, and GIT_CHECKOUT, GIT_STRATEGY without success.
What am I missing?
.gitlab-ci.yml
variables:
GIT_SUBMODULE_STRATEGY: recursive
stages:
- Build
Test Build:
image: python:2.7
stage: Build
tags:
- docker
script:
- ls
- ls cas-modbus-stack
.gitmodules
[submodule "cas-modbus-stack"]
path = cas-modbus-stack
url = ../../chipkin/cas-modbus-stack.git
Gitlab output:
Running with gitlab-runner 11.3.1~beta.4.g0aa5179e (0aa5179e)
on docker-builder-salmon fa2708eb
Using Docker executor with image python:2.7 ...
Pulling docker image python:2.7 ...
Using docker image sha256:3c01ed1c16af3efc2b7e6faa44cfbb2eeb5f241a5ad3b57cf7c14300ed4ebef5 for python:2.7 ...
Running on runner-fa2708eb-project-4206088-concurrent-0 via docker-builder-salmon...
Fetching changes...
HEAD is now at 1e07991 Removed sudo
From https://gitlab.com/chipkin/helloworld-ci
1e07991..30cdb87 master -> origin/master
Checking out 30cdb870 as master...
Updating/initializing submodules recursively...
$ ls
README.md
$ ls cas-modbus-stack/
ls: cannot access 'cas-modbus-stack/': No such file or directory
ERROR: Job failed: exit code 1
Solution 1:
I resolved my issue.
I needed to use git to add the sub module to the project, I can't just manually add it by updating the .gitmodules file.
git submodule add ../../chipkin/cas-modbus-stack.git