Runner doesn't find submodule

Hello,
I’m facing an issue while trying to pull a submodule on a private group. I would like to pull on a project the submodule stockdemos, which is on the same group.

On my .gitlab-ci I have GIT_SUBMODULE_STRATEGY: recursive

This submodule (which is on the same group as my project starting the CI):

[submodule "stockdemos"]
	path = stockdemos
	url = ../stockdemos.git

In the CI, I keep getting this error (I checked the linked, they are correct)

Updating/initializing submodules recursively with git depth set to 20...
Submodule 'stockdemos' (https://gitlab-ci-token:[MASKED]@gitlab.com/csgofacts/stockdemos.git) registered for path 'stockdemos'
Synchronizing submodule url for 'stockdemos'
Cloning into '/builds/csgofacts/backend/stockdemos'...
remote: The project you were looking for could not be found or you don't have permission to view it.
fatal: repository 'https://gitlab.com/csgofacts/stockdemos.git/' not found
fatal: clone of 'https://gitlab-ci-token:[MASKED]@gitlab.com/csgofacts/stockdemos.git' into submodule path '/builds/csgofacts/backend/stockdemos' failed
Failed to clone 'stockdemos'. Retry scheduled
Cloning into '/builds/csgofacts/backend/stockdemos'...
remote: The project you were looking for could not be found or you don't have permission to view it.
fatal: repository 'https://gitlab.com/csgofacts/stockdemos.git/' not found
fatal: clone of 'https://gitlab-ci-token:[MASKED]@gitlab.com/csgofacts/stockdemos.git' into submodule path '/builds/csgofacts/backend/stockdemos' failed
Failed to clone 'stockdemos' a second time, aborting

I really don’t know what is the issue (believe me, I searched on google), but I guess it is something stupid as I think I’m not on an edge case ? I have the error on a group runner and also on the shared runners.
Thank you for your time :slight_smile:

1 Like

Hi, I also have the same issue.

I have a private group with several projects and one of them (called A in next sentences) use the others as submodules. Everything was working well since, one or 2 weeks ago, I created a new project that I wanted to add as submodule to project A. Do not know why but, it does not work and I have the exact same logging report in the CI Jobs console as @Julien2313.
I am sure that I followed the exact same steps to create the new git project as the olders.

Same as above, I use a group runner that is registered to my computer gitlab runner (in docker) and also have GIT_SUBMODULE_STRATEGY: recursive in my .gitlab-ci.yml.

All works well, if I remove the new git project as a submodule (as it was before).

1 Like

Having the same issue:

GIT_SUBMODULE_STRATEGY: recursive

Updating/initializing submodules recursively with git depth set to 20...
Submodule 'buildroot' (https://gitlab-ci-token:[MASKED]@gitlab.anys.com/anys/buildroot.git) registered for path 'buildroot'
Synchronizing submodule url for 'buildroot'
Cloning into '/builds/anys/br2-external/buildroot'...
remote: The project you were looking for could not be found or you don't have permission to view it.
fatal: repository 'https://gitlab.anys.com/anys/buildroot.git/' not found
fatal: clone of 'https://gitlab-ci-token:[MASKED]@gitlab.anys.com/anys/buildroot.git' into submodule path '/builds/anys/br2-external/buildroot' failed
Failed to clone 'buildroot'. Retry scheduled
Cloning into '/builds/anys/br2-external/buildroot'...
remote: The project you were looking for could not be found or you don't have permission to view it.
fatal: repository 'https://gitlab.anys.com/anys/buildroot.git/' not found
fatal: clone of 'https://gitlab-ci-token:[MASKED]@gitlab.anys.com/anys/buildroot.git' into submodule path '/builds/anys/br2-external/buildroot' failed
Failed to clone 'buildroot' a second time, aborting
Cleaning up project directory and file based variables
00:01
ERROR: Job failed: exit code 1

Same issue here: https://forum.gitlab.com/t/submodules-in-ci-cd-not-accessible/82575

Sorry if this has already been answered. I found my solution: say you’ve got a private group G with projects P1 and P2. P1 includes submodule …/P2.

Toy need to go into the P2 projects settings, under CI/CD settings (NOT PERMISSIONS ! Which is what threw me). Under the CICD settings, you go to something like “pipeline tokens” or something. I have no power now and 0.2 mbits/sec on my phone, so can’t easily check exactly.

But under P2->settings->CI/CD->pipeline token, add the group GitLab.COM/myname/G/P1. This gives the P1 pipeline access to clone the P2 project.

This must be a new feature.

1 Like

Hi !
Your solution @ccrome works also for me, it seems to be a new feature added by 15.9 so for gitlab projects created before this release, the option in Settings>CI/CD>Token Access “Allow access to this project with a CI_JOB_TOKEN” is disabled but for the new ones, this is enabled by default.
We could then either deactivate this option or as you said, add the project that runs the CI/CD job and uses the submodule.

Thanks for the help !

1 Like