Gitlab runner has not acces to submodule
Asked Answered
B

2

7

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' ([email protected]: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 '[email protected]: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 '[email protected]:user/hfdg.git' into submodule path 'C:/gitlab-runner/builds/765197b3/0/user/ttttttt/hfdg' failed
Failed to clone 'hfdg' a second time, aborting
Beauharnais answered 31/1, 2020 at 8:29 Comment(0)
B
0

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

Beauharnais answered 9/2, 2020 at 21:16 Comment(2)
Hi, how do you assign gitlab-runner to sub-repo? Thanks.Entrust
Open the sub-repo page in Gitlab then go to Setting->CI/CID->Runners. There you can add Runners to a Projekt.Beauharnais
O
7

Another good reason for that is Allow access to this project with a CI_JOB_TOKEN settings in submodule project. So take a look into: Settings > CI/CD > Token Access

Oppenheimer answered 30/3, 2023 at 10:49 Comment(0)
B
0

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

Beauharnais answered 9/2, 2020 at 21:16 Comment(2)
Hi, how do you assign gitlab-runner to sub-repo? Thanks.Entrust
Open the sub-repo page in Gitlab then go to Setting->CI/CID->Runners. There you can add Runners to a Projekt.Beauharnais

© 2022 - 2024 — McMap. All rights reserved.