GitLab Runner MacOS作业失败,无法调试

时间:2019-02-21 13:26:34

标签: gitlab gitlab-ci-runner

我正在使用单个macOS GitLab运行程序执行iOS作业。跑步者已成功与GitLab配对并接收到作业,但是,作业立即失败,跑步者向GitLab报告。

通过查看运行程序日志,即使在--debug模式下运行GitLab运行程序,我也无法找到问题所在。

问题:

  1. 该问题可能与什么有关?
  2. 如何收集有关它的更多信息?

GitLab Web界面上的作业报告:

Running with gitlab-runner 11.7.0 (8cc638ff)
  on iMac 8cc638ff
Using Shell executor...
Running on name-iMac.local...
Fetching changes...
ERROR: Job failed: exit status 1

gitlab-runner --debug run命令的输出:

Checking for jobs... received                       job=216 repo_url=https://gitlab.local/software/ios.git runner=00000000
Failed to requeue the runner:                       builds=1 runner=00000000
Running with gitlab-runner 11.7.0 (8bb608ff)        job=216 project=34 runner=00000000
  on iMac 00000000                                  job=216 project=34 runner=00000000
Shell configuration: environment: []
dockercommand:
- sh
- -c
- "if [ -x /usr/local/bin/bash ]; then\n\texec /usr/local/bin/bash --login\nelif [
  -x /usr/bin/bash ]; then\n\texec /usr/bin/bash --login\nelif [ -x /bin/bash ]; then\n\texec
  /bin/bash --login\nelif [ -x /usr/local/bin/sh ]; then\n\texec /usr/local/bin/sh
  --login\nelif [ -x /usr/bin/sh ]; then\n\texec /usr/bin/sh --login\nelif [ -x /bin/sh
  ]; then\n\texec /bin/sh --login\nelif [ -x /busybox/sh ]; then\n\texec /busybox/sh
  --login\nelse\n\techo shell not found\n\texit 1\nfi\n\n"
command: bash
arguments:
- --login
passfile: false
extension: ""
  job=216 project=34 runner=00000000
Using Shell executor...                             job=216 project=34 runner=00000000
Waiting for signals...                              job=216 project=34 runner=00000000
Executing build stage                               build_stage=prepare_script job=216 project=34 runner=00000000
Executing build stage                               build_stage=get_sources job=216 project=34 runner=00000000
Executing build stage                               build_stage=upload_artifacts_on_failure job=216 project=34 runner=00000000
WARNING: Job failed: exit status 1                  duration=538.074ms job=216 project=34 runner=00000000

我正在使用的gitlab-ci.yml文件:

stages:
  #- unit_tests
  - test_flight

variables:
  LC_ALL: "en_US.UTF-8"
  LANG: "en_US.UTF-8"

before_script:
  - gem install bundler
  - bundle install

# unit_tests:
#   dependencies: []
#   stage: unit_tests
#   artifacts:
#     paths:
#       - fastlane/screenshots
#       - fastlane/logs
#   script:
#     - fastlane tests
#   tags:
#     - ios

test_flight_build:
  dependencies: []
  stage: test_flight
  artifacts:
    paths:
      - fastlane/screenshots
      - fastlane/logs
  script:
    - fastlane beta
  tags:
    - ios
  only:
     - /^release-.*$/
     - master
     - testflight

1 个答案:

答案 0 :(得分:1)

检查〜/ .bash_profile和〜/ .profile中是否有可能自动失败的行。

GitLab Runner在其restore_cache阶段的顶部执行docker network connect <nzbhydra network> <sonarr container>,这将导致失败的命令(包括配置文件中的任何命令)发出管道错误,使其在该阶段默默退出。

就我而言:

set -eo pipefail

一旦我注释掉这一行(我在两个文件中都有它),我的Mac的GitLab运行程序就可以运行

这是一个棘手的问题,因为这不会导致我的普通终端出现任何错误行为。我必须通过调试运行程序并明确测试脚本,直到找到失败的脚本,才能弄清楚