将末端日志从gitlab作业保存到variabl

发布于 2025-02-03 18:30:20 字数 185 浏览 3 评论 0 原文

Co.一起工作的新手

我是

- backstop test
- ERROR_MSG='Here Console.Log'

与gitlab,ci,.yml,shell and 变量 “ error_msg”“

我的问题现在是,如何将跑步者的登录到variabl中?

I'm new into work with Gitlab, CI, .yml, shell and Co.

I'm running in my .gitlab-ci.yml this Job

- backstop test
- ERROR_MSG='Here Console.Log'

And I want to save this Terminal Log, that I see while the job is running in the variabl
"ERROR_MSG""

My question is now, how can I get the Log out of the runner into the variabl?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

薄荷梦 2025-02-10 18:30:20

您可以这样做:
它通过将其上传为伪影文件来传递变量。
Gitlab CI内置功能将使其在下一阶段作为变量可用。

stages:
  - "build"
  - "test"

build:
  stage: build
  script:
    - echo "OUT=TEST IT NOW" >> build.env
    - cat build.env
  artifacts:
    reports:
      dotenv: build.env

test:
  stage: test
  script:
    - echo $OUT
  dependencies:
    - "build"

参考:

这仅适用于单行值,如果有新行,这将失败。

You can do it like this:
It passes the variable by uploading it as an artifact file.
And GitLab ci built-in functionality will make it available as a variable in the next stage.

stages:
  - "build"
  - "test"

build:
  stage: build
  script:
    - echo "OUT=TEST IT NOW" >> build.env
    - cat build.env
  artifacts:
    reports:
      dotenv: build.env

test:
  stage: test
  script:
    - echo $OUT
  dependencies:
    - "build"

Reference:
https://docs.gitlab.com/ee/ci/variables/#pass-an-environment-variable-to-another-job

This will work for single line values only, if there is a new line this will fail.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文