CI access right on private repository submodule

Hello,

I have some trouble in CI when I use submodules.
At the" Updating/initializing submodules recursively…" step I have the following error:

Submodule ‘macros’ (https://gitlab.com/group/subgroup/submodule.git) registered for path ‘macros’
Cloning into ‘/builds/group/subgroup/…/submodule’…
fatal: could not read Username for ‘https://gitlab.com’: No such device or address
fatal: clone of ‘https://gitlab.com/group/subgroup/submodule.git’ into submodule path ‘/builds/group/subgroup/…/submodule’ failed
Failed to clone ‘macros’. Retry scheduled
Cloning into ‘/builds/group/subgroup/…/submodule’…
fatal: could not read Username for ‘https://gitlab.com’: No such device or address
fatal: clone of ‘/builds/group/subgroup/…/submodule.git’ into submodule path ‘/builds/group/subgroup/…/submodule’ failed
Failed to clone ‘macros’ a second time, aborting

I’m pretty new with CI and Git-Lab. It’s seems a bad permission setup. Can someone help me with this setup?
I have no problem when the project do not have dependencies\submodules.

Thank you

Hi,

this line sounds suspicious.

The default transport goes for https, but the submodule needs different access. Can you share the configuration of the submodule in your repository?

cat .gitmodules

I’d say either you are not able to clone with the current repository permissions, requiring leveraged group access. Or something weird is configured in the submodules themselves.

Also another thought: Maybe you’re using a cached token, you can enforce that with custom before_script execution shown in this example: Using Git submodules with GitLab CI/CD | GitLab

Cheers,
Michael

you can add the following config to your .gitlabci.yml, as the official documents said

variables:
GIT_SUBMODULE_STRATEGY: recursive

Using Git submodules with GitLab CI/CD | GitLab