代码之家  ›  专栏  ›  技术社区  ›  MakotoE

如何查看gitlab runner exec期间创建的日志?

  •  2
  • MakotoE  · 技术社区  · 6 年前

    我正在用测试GitLab CI管道 gitlab-runner exec . 在一个脚本中,Boost遇到了一个错误,它创建了一个日志文件。我想查看此日志文件,但不知道如何查看。

    .gitlab-ci.yml

    image: alpine
    
    variables:
      GIT_SUBMODULE_STRATEGY: recursive
    
    build:
      script:
      - apk add cmake
      - cd include/boost
      - sh bootstrap.sh
    

    sudo gitlab-runner exec docker build --timeout 3600
    

    输出的最后几行:

    Building Boost.Build engine with toolset ... 
    Failed to build Boost.Build build engine
    Consult 'bootstrap.log' for more details
    ERROR: Job failed: exit code 1
    FATAL: exit code 1    
    

    bootstrap.log

    附加 - cat bootstrap.log 不输出文件内容,因为运行程序在此行之前退出。我试着用眼睛看过去的容器 sudo docker ps -a ,但这并没有显示GitLab Runner使用的。我怎么开 bootstrap.log文件

    1 回复  |  直到 6 年前
        1
  •  6
  •   MakotoE    6 年前

    您可以为日志声明工件:

    image: alpine
    
    variables:
      GIT_SUBMODULE_STRATEGY: recursive
    
    build:
      script:
        - apk add cmake
        - cd include/boost
        - sh bootstrap.sh
    
      artifacts:
        when: on_failure
        paths:
          - include/boost/bootstrap.log
    

    之后,您将能够通过web界面下载日志文件。

    注意,使用 when: on_failure 将确保 bootstrap.log