gitlab-ci - gitlab runner 不适用于特定项目

标签 gitlab-ci gitlab-ci-runner

我注册了 GitLab runner 的 11 个项目。除了 1 个项目外,每个项目的运行者都可以正常工作。我第一次注册这个项目的运行者,它有效。
但是在我提交/推送一些更改后,发生错误并且作业失败。
我看到一些解决方案,升级git版本解决了一个问题,但我不这么认为。因为除了这个项目,所有的运行者都工作得很好。

服务器操作系统:CentOS 7
混帐:1.8.3.1

First time registered runner
>Running with gitlab-runner 11.9.2 (...)
  on (...)
Using Shell executor...
Running on localhost.localdomain...
Initialized empty Git repository in /home/gitlab-runner/(...)/.git/
Clean repository
Fetching changes with git depth set to 50...
Created fresh repository.
From https://gitlab.com/(...)
 * [new branch]      master     -> origin/master
Checking out (...) as master...
Skipping Git submodules setup
$ echo "> gitlab-ci started"
> gitlab-ci started
$ cd /home/(..)
$ echo "> git pull started"
> git pull started
$ git pull
remote: Total 0 (delta 0), reused 0 (delta 0)
Already up-to-date.
Job succeeded

第二次提交/拉取,然后
>Running with gitlab-runner 11.9.2 (...)
  on (...)
Using Shell executor...
Running on localhost.localdomain...
Reinitialized existing Git repository in /home/gitlab-runner/(...)/.git/
Clean repository
Fetching changes with git depth set to 50...
fatal: remote origin already exists.
fatal: git fetch-pack: expected shallow list
ERROR: Job failed: exit status 1

编辑。这是我的 .gitlab-ci.yml
stages:
- deploy

deploy_to_master:
  stage: deploy

  script:
  - echo "> gitlab-ci started"
  - cd /home/www/dir
  - echo "> git pull started"
  - git pull
  - echo "> permission set"
  - chmod 707 -R ./data/
  - chmod 707 -R ./plugin/nice/
  - chmod 707 ./favicon.ico
  - echo "> server reload(=httpd -k graceful)"
  - systemctl reload httpd

  only:
  - master

  tags:
  - tags

最佳答案

Centos 7 附带 git 版本 1.8.3.1 。此版本不支持 git fetch-pack 之类的命令。要解决此问题,您可以从 IUS 存储库更新服务器上的 git。
update git on Centos 7 to version 2 from third-party IUS repo

$ git --version
git version 1.8.3.1
sudo yum -y install https://packages.endpoint.com/rhel/7/os/x86_64/endpoint-repo-1.7-1.x86_64.rpm
sudo yum install git

关于gitlab-ci - gitlab runner 不适用于特定项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56663096/

相关文章:

docker - Gitlab CI-错误: Job failed: executor requires OSType=linux,,但Docker Engine仅支持OSType = windows

gitlab-ci - 从 Gitlab 管道构建 Packer

amazon-web-services - CICD 的 AWS API Gateway 动态 StageName

另一台服务器上的 Gitlab-runner

unit-testing - GitLab 中的代码覆盖率始终未知

gitlab - `git clone project2` 在 gitlab-ci.yml 中?

iOS : gitlab-runner stuck on CI

docker - 冲突。容器名称 "/gitlab-runner"已被容器使用

GITLAB:将脚本输出保存在变量 .gitlab-ci.yml 中

node.js - 如何使用 Azure api 启动容器实例?