Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clone external private submodule with deploy token from Gitlab-CI

I have a repository repoB on a private server serverB, and get a deploy token (user + password) from it.
This repository is used as a submodule in the project I'm trying to configure.

In this project, I want to be able to init this submodule during the Gitlab-CI.

My .gitmodules is:

[submodule "repoB"]
    path = repoB
    url = https://serverB/groupB/repoB.git

And I have in my .gitlab-ci.yml:

test_build:
    variables:
        GIT_SUBMODULE_STRATEGY: recursive

Actually, the error I get is the following (group: japan7, project: nanachan, repoB: karaneko, serverB: git.inpt.fr)

Error from the CI job

I suppose that I should put the deploy token user and password in the project secrets (in Settings −> CI / CD −> Variables) but I could not find the name of these variables, nor any help to solve this particular case.

How should I proceed?
Thank you in advance for your help!

like image 245
mistiru Avatar asked Nov 22 '18 13:11

mistiru


1 Answers

I solved same issue using deploy token. Just added submodule with deploy token and everything on CI runs ok.

http://<username>:<deploy_token>@gitlab.example.com/tanuki/awesome_project.git

And .gitmodules looks like:

[submodule "tanuki/awesome_project"]
    path = tanuki/awesome_project
    url = https://<username>:<deploy_token>@gitlab.example.com/tanuki/awesome_project.git

https://docs.gitlab.com/ee/user/project/deploy_tokens/

like image 125
Celly Avatar answered Sep 30 '22 08:09

Celly