Search code examples
gitlabgitlab-ci-runner

Gitlab runner has not acces to submodule


I create a new Project with a Submodule and want to run a gitlab-ci.yml. But every time the runner tells me he has no access or cant find the project. The runner is an shared runner on a windows 10 system (required). It works for older projects but not for new projects.

Have you some ideas what i do wrong?

What i already do:

  • test on another runner
  • use fetch and clone for runner
  • run manualy git clone --recursive git@gitlab.... on the runner VM
  • clone repo recursive on my current pc and it worked!
  • The first answer

CI-Script:

stages:
  - build

variables:
  ARTIFACTS_OUTPUT_PATH: "./builds"
  GIT_SUBMODULE_STRATEGY: recursive

test_123:
    stage: build
    only:
        - tags
        - triggers
        - schedules
        - web
    script: 
        - some commands

    artifacts:
        paths:
          - ./builds/*
    tags:
        - windows

The error:

<!-- language: lang-sh -->
Cloning into 'C:/gitlab-runner/builds/765197b3/0/user/ttttttt'...
Submodule 'hfdg' (git@gitlab.XXXXXXXX:user/hfdg.git) registered for path 'hfdg'
Cloning into 'C:/gitlab-runner/builds/765197b3/0/user/ttttttt/hfdg'...
remote: 
remote: ========================================================================
remote: 
remote: The project you were looking for could not be found.
remote: 
remote: ========================================================================
remote: 
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: clone of 'git@gitlab.XXXXXXXX:user/hfdg.git' into submodule path 'C:/gitlab-runner/builds/765197b3/0/user/ttttttt/hfdg' failed
Failed to clone 'hfdg'. Retry scheduled
Cloning into 'C:/gitlab-runner/builds/765197b3/0/user/ttttttt/hfdg'...
remote: 
remote: ========================================================================
remote: 
remote: The project you were looking for could not be found.
remote: 
remote: ========================================================================
remote: 
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: clone of 'git@gitlab.XXXXXXXX:user/hfdg.git' into submodule path 'C:/gitlab-runner/builds/765197b3/0/user/ttttttt/hfdg' failed
Failed to clone 'hfdg' a second time, aborting

Solution

  • The problem was that the GitLab-runner wasn't assigned to the subrepo. So the Runner has no access to the subrepo.