gitlab-runner 使用目录路径而不是 URL 来克隆;失败 "does not appear to be a git repository"

gitlab-runner using directory path instead of URL to clone; fails with "does not appear to be a git repository"

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

我在 these instructions.

之后在本地(在我的 GNU/Linux 盒子上)安装了 gitlab-runner

现在,当我 运行 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 克隆 URL,这显然行不通。

我尝试指定 --clone-url=,但我无法理解整个项目 URL 的哪一部分(无论是在主 git 存储库中,还是在 git实验室镜子)我应该使用。

有什么线索吗?

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

sudo setenforce 0

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

惰性修复是让 SELinux 全面允许 activity,例如,如果您没有足够频繁地执行此类操作以保证策略更改。

安全意识越强的人越倾向于编辑政策。在拒绝错误中找出一些唯一标识符,然后创建一个新策略以允许它

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