Gitlab-CI PHP可执行文件返回错误代码255

时间:2017-06-04 09:03:37

标签: php docker gitlab-ci gitlab-ci-runner

我最近在自我托管的GitLab CE实例中设置了GitLab-CI。我为一个特定的项目和一个共享的跑步者创建了一个跑步者。

我的/etc/gitlab-runner/config.toml正在关注:

concurrent = 1
check_interval = 0

[[runners]]
  name = "project runner"
  url = "https://gitlab.domain.com/ci"
  token = "SECRET"
  executor = "docker"
  [runners.docker]
    tls_verify = false
    image = "geertw/docker-php-ci:7.0-no-xdebug"
    privileged = false
    disable_cache = false
    volumes = ["/cache"]
    shm_size = 0
  [runners.cache]

[[runners]]
  name = "shared runner"
  url = "https://gitlab.domain.com"
  token = "SECRET"
  executor = "docker"
  [runners.docker]
    tls_verify = false
    image = "geertw/docker-php-ci:7.0-no-xdebug"
    privileged = false
    disable_cache = false
    volumes = ["/cache"]
    shm_size = 0
  [runners.cache]

然后我在我的composer.json文件中添加了自定义脚本:

...

"scripts": {
    "build": [
        "@composer install --no-progress --no-interaction --no-suggest",
        "@lint"
    ],
    "lint": "php -d display_errors -d display_startup_errors ./vendor/bin/parallel-lint --exclude vendor ."
}

该脚本是我.gitlab-ci.yml文件的一部分:

before_script:
  - php -v

services:
  - mysql:latest

variables:
  MYSQL_DATABASE: "database"
  MYSQL_ROOT_PASSWORD: "password"

build:7.0:
  image: geertw/docker-php-ci:7.0
  script:
    - composer build
    - php vendor/bin/phpunit --coverage-text --colors=never

build:7.1:
  image: geertw/docker-php-ci:7.1-no-xdebug
  script:
    - composer build

cache:
  paths:
    - vendor/

当我在GitLab中执行管道时,收到错误:

> php -d display_errors -d display_startup_errors ./vendor/bin/parallel-lint --exclude vendor .
Script php -d display_errors -d display_startup_errors ./vendor/bin/parallel-lint --exclude vendor . handling the lint event returned with error code 255
ERROR: Job failed: exit code 1

现在,当我在本地运行composer lint时,它按预期工作。我也尝试将其注释掉,并且我在PHPUnit(build:7.0 in .gitlab-ci.yml)中收到了同样的错误。出于调试原因,我添加了php -d来显示错误,但没有显示任何内容。

另一个(私有)管道按预期工作,具有完全相同的.gitlab-ci.yml文件的较小项目。我也试过从一个跑步者切换到另一个跑步者,但它也不起作用。

由于我是docker和CI的新手,我对如何正确调试这种情况知之甚少,也许增加了php memory_limit 以某种方式或输出错误到stderr。

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

原来有一个自动加载器用@call执行ext-mysqli函数。该应用程序是一团糟。