簡體   English   中英

gitlab-runner 使用目錄路徑而不是 URL 來克隆; 失敗並顯示“似乎不是 git 存儲庫”

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

我正在嘗試在本地運行我的 GitLab CI 測試,以加快 CI 的開發速度。

我按照這些說明在本地(在我的 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 鏡像中)。

有什么線索嗎?

如果您使用 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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM