On our Gitlab server I have two repos, where one repo ('EPSILON-SDK-C') is a submodule in the other. When I run gitlab-runner locally on my developer machine
sudo gitlab-runner exec docker build_fw
gitlab-runner can't find the submodule, as seen in this ouput from gitlab-runner:
Updating/initializing submodules...
Submodule 'thirdparty/EPSILON-SDK-C' (/home/me/gitlab_repos/EPSILON-SDK-C) registered for path 'thirdparty/EPSILON-SDK-C'
fatal: repository '/home/me/gitlab_repos/EPSILON-SDK-C' does not exist
fatal: clone of '/home/me/gitlab_repos/EPSILON-SDK-C' into submodule path '/builds/0/project-0/thirdparty/EPSILON-SDK-C' failed
Failed to clone 'thirdparty/EPSILON-SDK-C'. Retry scheduled
fatal: repository '/home/me/gitlab_repos/EPSILON-SDK-C' does not exist
fatal: clone of '/home/me/gitlab_repos/EPSILON-SDK-C' into submodule path '/builds/0/project-0/thirdparty/EPSILON-SDK-C' failed
Failed to clone 'thirdparty/EPSILON-SDK-C' a second time, aborting
ERROR: Job failed: exit code 1
FATAL: exit code 1
However, when our Gitlab server is triggered by a commit, Gitlab successfully builds a binary using the submodule, as seen in this Gitlab pipeline output (4-5 lines removed for clarity):
Updating/initializing submodules...
Synchronizing submodule url for 'thirdparty/EPSILON-SDK-C'
Entering 'thirdparty/EPSILON-SDK-C'
(4-5 lines here removed for readabilty)
Authenticating with credentials from job payload (GitLab Registry)
Question: Gitlab has no problems locating the submodule, so why can't the local gitlab-runner find the submodule?
My .gitlab-ci.yml looks like this:
image: "gitlab.company.local:4567/me/dockerforfw:latest"
stages:
- build
build_fw:
stage: build
variables:
GIT_SUBMODULE_STRATEGY: normal
script:
- "bash bin/dorelease_linux.sh"
My .gitmodules looks like this:
$ cat .gitmodules
[submodule "thirdparty/EPSILON-SDK-C"]
path = thirdparty/EPSILON-SDK-C
url = ../EPSILON-SDK-C
Note that the submodule URL is relative, as required by the Gitlab documentations: https://docs.gitlab.com/ee/ci/git_submodules.html#configuring-the-gitmodules-file
I do have access to the submodule repo, so I don't this issue is related to permissions:
$ git submodule sync
Synchronizing submodule url for 'thirdparty/EPSILON-SDK-C'
My local gitlab-runner is version 12.3.0 (a8a019e0), and our Gitlab server is version GitLab Enterprise Edition 12.3.4-ee.
Things I have tried:
I have tried with ab absolute URL for the submodule. I've also tried keeping a local clone of the submodule repo in /home/me/gitlab_repos/ I also tried adding these before_script actions:
before_script:
- git submodule sync --recursive
- git submodule update --init --recursive
(UPDATE: I've edited my question for clarity)