Gitlab运行程序从错误的URI中提取子模块

时间:2019-06-17 20:35:18

标签: gitlab gitlab-ci gitlab-ci-runner

我在服务器上运行Gitlab的本地实例,该实例正在设置中以支持我的项目的CI。我正在使用基于Ubuntu 18.04 LTS的自定义docker映像,该映像在服务器上可用。

该项目使用的是我最初使用其Github SSH URL添加的子模块。直到今天,当我意识到git submodule update步骤由于权限不足而出错时,由于容器中不存在SSH密钥,因此此方法工作正常。在这里和其他地方阅读了许多很棒的文章后,我决定将子模块的URL切换为HTTPS,以避免弄乱SSH密钥。 .gitmodules文件现在看起来像这样:

[submodule "externals/translation-server"]
    path = externals/translation-server
    url = https://github.com/zotero/translation-server.git

但是,只要gitlab运行程序运行,它 still 都会尝试从其 SSH URL克隆子模块:

$ git submodule update --init --remote --merge
Cloning into '/builds/com/prj/externals/translation-server'...
Host key verification failed.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: clone of 'git@github.com:zotero/translation-server.git' into submodule path '/builds/com/prj/externals/translation-server' failed
Failed to clone 'externals/translation-server'. Retry scheduled
Cloning into '/builds/com/prj/externals/translation-server'...
Host key verification failed.
fatal: Could not read from remote repository.

当我运行docker容器并手动执行gitlabRunner采取的步骤时,它们都可以正常工作:

# docker run -i -t -v`pwd`:/builds/com/prj docker-image /bin/bash
root@fcc6b0d990ad:/# cd /builds/com/prj/
root@fcc6b0d990ad:/builds/com/prj# git submodule update --init --recursive --remote --merge
Cloning into '/builds/com/prj/externals/translation-server/modules/zotero'...
Submodule path 'externals/translation-server/modules/zotero': checked out '42782f73fbddc1a44d9b655ad4c715de05b07345'

要测试有关Gitlab或跑步者出问题的理论,我创建了一个测试库,然后:

  • 添加了一个git模块:git submodule add https://github.com/zotero/translation-server.git
  • 添加了与上述项目相同的Gitlab CI yaml文件
  • 推送到服务器

然后,我观察到该作业正在运行,并且……按预期方式工作:该模块从其HTTPS URL中拉出,没有发生错误。

gitlab的运行程序是否正在使用某种缓存来覆盖.gitmodules中模块的HTTP URL?我还可以做些什么来进一步调查此问题?

非常感谢您对诊断此问题的帮助。

0 个答案:

没有答案
相关问题