代码之家  ›  专栏  ›  技术社区  ›  Richard Topchii

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

  •  0
  • Richard Topchii  · 技术社区  · 6 年前

    通过查看运行程序日志,我无法跟踪问题,即使在 --debug 模式。

    问题:

    1. 如何收集更多关于它的信息?

    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
    
    0 回复  |  直到 6 年前
        1
  •  6
  •   fury    6 年前

    检查您的~/.bash_配置文件和~/.profile以查找可能会自动失败的行。

    GitLab Runner做了一个 set -eo pipefail 在其restore_cache阶段的顶部,该阶段会导致失败的命令(包括配置文件中的任何命令)发出管道错误,使其在该阶段静默退出。

    就我而言:

    [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
    

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

    这是一个棘手的问题,因为这不会导致我的正常终端显示出任何错误的行为。我必须通过调试运行程序并显式地测试脚本来解决这个问题,直到找到一个失败的脚本