[CI] Submodule: Not a git repository

Summary

When running a CI job for a repo with a submodule, the synchronization of the submodule fails with a fatal error.

Steps to reproduce

  • Create repo
  • Add submodule under ./a/mysubmodule
  • Let ./a/mysubmodule say gitdir: ../../.git/modules/a/mysubmodule
  • Run CI job with GIT_SUBMODULE_STRATEGY: recursive

What is the current bug behavior?

The CI job reports

Running with gitlab-ci-multi-runner 9.3.0 (3df822b)
  on animate-x3 (013b430e)
Using Docker executor with image x-debian ...
Using docker image sha256:2bfa193793f6d0996b90d7f47db05c591f521edd94f97f0f13fcf2e03e02a3a5 for predefined container...
Using locally found image version due to if-not-present pull policy
Using docker image x-debian ID=sha256:e109242d28350d748992e5be86ed42651c323fa61bc1d25a45a3a7c58c95d893 for build container...
Running on runner-013b430e-project-2-concurrent-0 via animate-x3...
Fetching changes...
HEAD is now at 7438d16 CI: Fix submodule issue
Checking out 7438d161 as master...
Updating/initializing submodules recursively...
Synchronizing submodule url for 'a/mysubmodule'
fatal: Not a git repository: ../../.git/modules/a/mysubmodule
fatal: Not a git repository: ../../.git/modules/a/mysubmodule
fatal: Not a git repository: ../../.git/modules/a/mysubmodule
fatal: Not a git repository: ../../.git/modules/a/mysubmodule
Cannot chdir to , the toplevel of the working tree
ERROR: Job failed: exit code 1

Note that for some reason the CI job tries to chdir into ''.

What is the expected correct behavior?

The submodule should be synchronized without any error.

Results of GitLab environment info

System information
System:		Debian 9.0
Current User:	git
Using RVM:	no
Ruby Version:	2.3.3p222
Gem Version:	2.6.6
Bundler Version:1.13.7
Rake Version:	10.5.0
Redis Version:	3.2.5
Git Version:	2.13.0
Sidekiq Version:5.0.0
Go Version:	unknown

GitLab information
Version:	9.3.2
Revision:	254b489
Directory:	/opt/gitlab/embedded/service/gitlab-rails
DB Adapter:	postgresql
URL:		http://animate-x3.mydomain.ds
HTTP Clone URL:	http://animate-x3.mydomain.ds/some-group/some-project.git
SSH Clone URL:	git@animate-x3.mydomain.ds:some-group/some-project.git
Using LDAP:	no
Using Omniauth:	no

GitLab Shell
Version:	5.0.5
Repository storage paths:
- default: 	/var/opt/gitlab/git-data/repositories
Hooks:		/opt/gitlab/embedded/service/gitlab-shell/hooks
Git:		/opt/gitlab/embedded/bin/git

Results of GitLab application Check

No errors reported.