douze1332 2017-02-16 17:15
浏览 25
已采纳

我如何调试失败的ci构建?

i created some tests with PHPUnit and laravel. The tests are running locally successful, but as a gitlab ci job there is an error.

Here is the ci log:

There was 1 failure:

1) Tests\Feature\AuthTest::testAuthLoggedInIsAdmin
Expected status code 200 but received 500.
Failed asserting that false is true.

/builds/XXX/webproject/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestResponse.php:55
/builds/XX/webproject/tests/Feature/AuthTest.php:53

For the better debug and finding a solution i need the error trace from the project or the error.log from the webserver.

What is the best practise to debug errors in the ci?

  • 写回答

1条回答 默认 最新

  • dstbtam8732 2017-02-16 17:33
    关注

    ok, the solution is very simple... i don't delete the question. Here is the solution:

    You have to add an artifact to the job. You can set the artifact, that only on failures the artifact is created. If there is an failure on the build, the hole project is dumped to a seperated location. Now you can browse each files on the dump.

    .gitlab-ci.yml

    stages:
      - test
      - deploy
    
    php-7.0:
      stage: test
      type: test
      services:
        - mysql:latest
      image: tetraweb/php:7.0
      script:
        - bash .gitlab-ci.sh
        - php vendor/bin/phpunit --coverage-text --colors=never
      artifacts:
        when: on_failure
        name: "${CI_BUILD_STAGE}_${CI_BUILD_REF_NAME}_FAILED"
        paths:
          - "."
        untracked: false
        expire_in: 1 day
    
    deploy:
      stage: deploy
    # etc...
    

    Here are more informations about artifacts.

    You can download the artifacts in the pipelines section in gitlab:

    Gitlab Artifacts download

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作