gitlab-runner使用目录路径而不是URL进行克隆;失败,出现“似乎不是git存储库”

超空的

我正在尝试在本地运行GitLab CI测试,以加快CI的开发速度。

gitlab-runner按照这些说明在本地安装(在我的GNU / Linux机器上)

现在,当我跑步时sudo gitlab-runner exec docker test,我得到:

sudo gitlab-runner exec docker test
Runtime platform                                    arch=amd64 os=linux pid=7133 revision=0e5417a3 version=12.0.1
Running with gitlab-runner 12.0.1 (0e5417a3)
Using Docker executor with image joyzoursky/python-chromedriver:2.7 ...
Pulling docker image joyzoursky/python-chromedriver:2.7 ...
Using docker image sha256:f593ebe67d0c75eb8e3d663412c8fc80df70bd08e835d7a64ba6afa21b1c2d8a for joyzoursky/python-chromedriver:2.7 ...
Running on runner--project-0-concurrent-0 via hostname...
Fetching changes...
Initialized empty Git repository in /builds/project-0/.git/
Created fresh repository.
fatal: '/home/USER/path/to/repo' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
ERROR: Job failed: exit code 1
FATAL: exit code 1                                 

/home/USER/path/to/repo是包含.gitlab-ci.yml和项目代码的工作目录的实际路径

因此,似乎gitlab-runner正在尝试将目录路径用作git clone URL,这显然行不通。

我尝试指定--clone-url=,但我不明白应使用完整项目URL的哪一部分(在主git repo或gitlab镜像中)。

有什么线索吗?

詹姆士

如果您使用的是Fedora并已启用SELinux;尝试将其设置为宽松:

sudo setenforce 0

SELinux阻止了某些现有策略不允许的任何活动。GitLab运行程序基本上是一个docker容器,试图访问主机上的文件,因此被阻止了......这导致运行程序报告您在以下位置没有有效的存储库(错误说它无法读取文件本来会更有意义,但我们并不生活在一个完美的世界中)

懒惰的解决方法是使SELinux一揽子允许活动,例如,如果您不经常做这种事情以致无法保证策略更改。

更加注重安全性的用户将更喜欢编辑策略。在拒绝错误中找出一些唯一的标识符,然后创建一个新策略以允许它

sudo grep <needle> /var/log/audit/audit.log | audit2allow -M gitlab
sudo semodule -i gitlab.pp

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章