我正在尝试在本地运行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 clone URL,这显然行不通。
我尝试指定--clone-url=
,但是我不明白我应该使用完整项目URL的哪一部分(在主git repo或gitlab镜像中)。
有任何线索吗?
答案 0 :(得分:1)
如果您在Fedora上并启用了SELinux;尝试将其设置为宽松:
sudo setenforce 0
侧面说明:为什么选择selinux,为什么?
答案 1 :(得分:0)
我在gitlab-runner中遇到相同的问题
gitlab-runner exec docker test
Pulling docker image python:3.7 ...
Using docker image sha256:... for python:3.7 ...
Running on runner--project-0-concurrent-0 via … ...
Fetching changes...
Initialized empty Git repository in /builds/project-0/.git/
Created fresh repository.
fatal: '/clone2/fwt' 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
git状态
On branch testM
nothing to commit, working directory clean
“ gitlab-runner exec”用于在本地执行构建。
“测试”是.gitlab-ci.yml文件中的作业示例:
stages:
- dev
variables:
DOCKER_DRIVER: overlay2
DOCKER_HOST: tcp://docker:2375/
services:
- docker:dind
test:
stage: dev
image: python:3.7
script:
- echo "success"
- python -V