Unable to fetch submodule on CI

Hi,

I’m currently trying to use the Gitlab CI using Gitlab.com for a project that uses a submodule.
When the runner comes to the submodule cloning, there the following error :

++ git checkout -f -q 18e98c77727a56f954a6cc9e19bad307e258145a
++ echo 'Updating/initializing submodules recursively...'
Updating/initializing submodules recursively...
++ git submodule sync --recursive
++ git submodule foreach --recursive git clean -ffxd
++ git submodule foreach --recursive git reset --hard
++ git submodule update --init --recursive
Submodule 'connectors' (git@gitlab.com:xxxxxx/yyyyyy.git) registered for path 'app/connectors'
Cloning into '/builds/xxxxxx/yyyyyy/app/connectors'...
fatal: cannot run ssh: No such file or directory
fatal: unable to fork
fatal: clone of 'git@gitlab.com:xxxxxx/yyyyyy.git' into submodule path '/builds/xxxxxx/yyyyyy/app/connectors' failed
Failed to clone 'app/connectors'. Retry scheduled
Cloning into '/builds/xxxxxx/yyyyyy/app/connectors'...
fatal: cannot run ssh: No such file or directory
fatal: unable to fork

There is my .gitlab-ci.yml configuration :

variables:
  GIT_SUBMODULE_STRATEGY: recursive

test:
  image: node:latest
  variables: 
    CI_DEBUG_TRACE: "true"
  script:
    - ...

I’ve also tried with the following configuration, without any success :

test:
  image: node:latest
  variables: 
    CI_DEBUG_TRACE: "true"
  before_script:
    - git submodule sync --recursive
    - git submodule update --init --recursive --remote
  script:
    - ...

The project and the submodule are privates repositories hosted in Gitlab.com.
I’m using the following .gitmodules file :

[submodule "connectors"]
	path = app/connectors
	url = git@gitlab.com:xxxxxx/yyyyyy.git

I’ve tried to replay the CI actions on my computer, without any problem.

Do you have an idea of what’s happening?

Many thanks for your help !!

1 Like

Just hit this, found these instructions: https://docs.gitlab.com/ee/ci/git_submodules.html

The submodule needs to be specified as a relative address, which will cause it to use https instead of ssh.