GitLab CI and submodules

Hello everyone. Today I have been trying to get a submodule onto my runner, and I can’t figure out how. I have created two SSCCE repos which demonstrate the issue as I experience it.

https://gitlab.com/briankcook/importme
containing exactly one small text file

https://gitlab.com/briankcook/importer
containing another small text file, and:

.gitmodules:

[submodule "importme"]
  path = importme
  url = ../importme.git
  branch = master

.gitlab-ci.yml:

image: centos:7
variables:
  GIT_SUBMODULE_STRATEGY: normal
  GIT_STRATEGY: clone
test:
  script:
    - find /builds/briankcook

As you can see in the job output the runner finds .gitmodules and so says:

Updating/initializing submodules...

… but apparently it does not actually do what it is claiming, since there is no importme directory on the runner!

Does anyone know how to properly configure submodules for CI? I have tried so many minor variations on this theme, and so far had no joy at all.

In the meantime, git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.myworkplace.tld/repo.git is a tolerable workaround, but I want to know how to get submodules to work so I don’t have to take this extra step every time.

Thanks in advance!

Did you try setting GIT_SUBMODULE_STRATEGY to recursive?

I have. I’ve just changed the .gitlab-ci.yml on master to use recursive strategy, but the result is the same.

I invite you to look through the repositories, there really is nothing there except the files I’ve described, and I’ve gone through several variations on this theme, unable to find the correct combination to make this work.

Thank you for the reply!

I ran into the same problem.
It is not cloning the submodule at all. Later ci can’t find it and fails.

Any solution to this problem?