admin管理员组文章数量:1206735
I'm new at git CI/CD and I want to execute tests that are developed in another private repository. For that, I thought about using gitlab submodules solution.
Right now, the only thing I want to do is to authenticate within the other repository and to check that the submodule is correctly syncronized. This is my .gitlab-ci.yml at the moment.
stages:
- check_sync
variables:
GIT_SUBMODULE_STRATEGY: recursive
image:
name: "python:3.12.0b4-alpine3.18"
before_script:
- apk add --no-cache git
- git submodule deinit --all --force
- git submodule add https://${CI_USER}:${CI_TOKEN}@gitlab/darkalex613/pythonpipelines.git submodule_testing
- git submodule sync --recursive
- git submodule update --init --recursive
check_submodule_job:
stage: check_sync
script:
- cd submodule_testing
- echo "changed to submodule_testing directory"
The gitlab runner is constantly failing with the authentication. I tried this:
- I configured 2 masked variables in the project that contains the submodule, one of them is the CI_TOKEN the other one is the CI_USER.
- I added the project to the "submodule project" in the CI/CD job tokens permission section
My .gitmodules file is the following one:
[submodule "submodule_testing"]
path = submodule_testing
url = .git
branch = main
What am I doing wrong? These are the logs from the runner after trying to execute the job
Running with gitlab-runner 17.7.0~pre.103.g896916a8 (896916a8)
on green-4.saas-linux-small-amd64.runners-manager.gitlab/default ntHFEtyX, system ID: s_8990de21c550
Preparing the "docker+machine" executor 00:08
Using Docker executor with image python:3.12.0b4-alpine3.18 ...
Pulling docker image python:3.12.0b4-alpine3.18 ...
Using docker image sha256:b1d0691bad2a1ec4f0e47f2f985156c8399ac9602ef56d646bdbe8f100e44fab for python:3.12.0b4-alpine3.18 with digest python@sha256:bcfd857481750417957f8510904e06301c6e27b3f0d6e27948e1398913627ee9 ...
Preparing environment 00:01
Running on runner-nthfetyx-project-66285420-concurrent-0 via runner-nthfetyx-s-l-s-amd64-1737403967-3a9db72e...
Getting source from Git repository 00:02
Fetching changes with git depth set to 20...
Initialized empty Git repository in /builds/[MASKED]/cicd-submodules-practice/.git/
Created fresh repository.
Checking out e0c89729 as detached HEAD (ref is main)...
Updating/initializing submodules recursively with git depth set to 20...
Submodule 'submodule_testing' (.git) registered for path 'submodule_testing'
Synchronizing submodule url for 'submodule_testing'
Cloning into '/builds/[MASKED]/cicd-submodules-practice/submodule_testing'...
fatal: could not read Username for '': No such device or address
fatal: clone of '.git' into submodule path '/builds/[MASKED]/cicd-submodules-practice/submodule_testing' failed
Failed to clone 'submodule_testing'. Retry scheduled
Cloning into '/builds/[MASKED]/cicd-submodules-practice/submodule_testing'...
fatal: could not read Username for '': No such device or address
fatal: clone of '.git' into submodule path '/builds/[MASKED]/cicd-submodules-practice/submodule_testing' failed
Failed to clone 'submodule_testing' a second time, aborting
I'm expecting to be able to execute the only job in the pipeline and pass it solving the authentication problem
本文标签: devopsGitlab submodules use in gitlabciyml filesStack Overflow
版权声明:本文标题:devops - Gitlab submodules use in -gitlab-ci.yml files - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738667565a2105794.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论