gpt4 book ai didi

docker - 你如何查看在 gitlab-runner exec 期间创建的日志?

转载 作者:行者123 更新时间:2023-12-02 18:21:08 25 4
gpt4 key购买 nike

我正在使用 gitlab-runner exec 测试 GitLab CI 管道.在执行脚本期间,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.gitlab-ci.yml不输出文件内容,因为运行程序在此行之前退出。我试着用 sudo docker ps -a 查看过去的容器,但这并没有显示 GitLab Runner 使用的那个。如何打开 bootstrap.log ?

最佳答案

您可以为日志声明一个工件:

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只有在构建失败时才会收集,从而在构建成功时节省磁盘空间。

关于docker - 你如何查看在 gitlab-runner exec 期间创建的日志?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52469662/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com