0%

GitLab CI问题记录

Job is stuck

Shell Runner跑CI任务,报错:

1
Job is stuck. Check runners. allowed to fail

解决办法:
经查是因为gitlab-runner版本比较高(15.5.0),新版本的runner,要求.gitlab-ci.yml必须要配置tags,指定runner。

setting GIT_CLONE_PATH is not allowed

Shell Runner跑CI任务,报错:

1
ERROR: Job failed: setting GIT_CLONE_PATH is not allowed, enable `custom_build_dir` feature

解决办法:启用custom_build_dir

1
vim /etc/gitlab-runner/config.toml

添加custom_build_dir配置

1
2
3
[[runners]]
[runners.custom_build_dir]
enabled = true

重启gitlab-runner

1
gitlab-runner restart

fatal: git fetch-pack

Shell Runner跑CI任务,报错:

1
2
fatal: git fetch-pack: expected shallow list
fatal: The remote end hung up unexpectedly

解决办法:
git版本问题,升级git

1
2
rpm -ivh http://opensource.wandisco.com/centos/7/git/x86_64/wandisco-git-release-7-1.noarch.rpm
yum install -y git

不能锁定配置文件

Shell Runner跑CI任务,报错:
error: 不能锁定配置文件 /home/gitlab-runner/builds/builds/xxx/main.tmp/git-template/config: 没有那个文件或目录

解决办法:
没有检索到找到解决办法,尝试降级到14.5.0,问题解决。降级方法参考【Linux环境安装runner】一节。

No such file or directory

Shell Runner跑CI任务,报错:

1
2
3
4
5
Skipping Git checkout
Skipping Git submodules setup
...
$ pip3 install -r requirements.txt
ERROR: Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt'

解决办法:.gitlab-ci.yml文件中添加GIT_CHECKOUT变量

1
2
variables:
GIT_CHECKOUT: "true"

下载镜像报错

Docker Machine Runner跑CI任务,一直正常。
Docker Machine Runner没有任何变动,突然有一天,执行docker build的时候,下载基础镜像报错:
ERROR: failed to do request: Head https://192.168.56.101:5000/v2/library/python/manifests/3.8: http: server gave HTTP response to HTTPS client

重启gitlab-runner问题依旧,重启机器问题依旧。

解决办法:runner配置里,指定docker image的版本为docker:19.03,而不要使用docker,否则一直会拉取最新版的docker,而最新版的docker不支持发送http请求镜像仓库。

  • 本文作者: 好好学习的郝
  • 本文链接: https://www.voidking.com/dev-gitlab-ci-problems/
  • 版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!源站会及时更新知识点及修正错误,阅读体验也更好。欢迎分享,欢迎收藏~