gpt4 book ai didi

Gitlab CI : is it possible to access artifacts from previous jobs that stores them in the same path?

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

如果有 2 个作业在同一路径中有工件,并且这两个作业都是同一作业的依赖项,Gitlab CI 的行为如何?

job1:
stage: stage1
artifacts:
paths:
- samedir

job2:
stage: stage1
artifacts:
paths:
- samedir

job3:
stage: stage2
dependencies:
- job1
- job2

我在 gitlab 文档中找不到示例或预期的行为。

行为是确定性的吗?如果 job1 和 job2 将相同的文件放在 samedir 中,job2 的工件是否会因为它们在依赖项中定义的顺序而覆盖来自 job1 的文件?

最佳答案

根据docs

Job artifacts created in the most recent successful pipeline for a specific ref are considered the latest artifacts. If you run two types of pipelines for the same ref, timing determines which artifacts are the latest.

为了证明这个说法,让我们考虑以下 .gitlab-ci.yml 文件

image: python:3.6

stages:
- stage1
- stage2
- stage3


job1:
stage: stage1
script:
- echo "artifact from stage 1" > test.txt
artifacts:
paths:
- test.txt


job2:
stage: stage1
script:
- echo "artifact from stage 2" > test.txt
artifacts:
paths:
- test.txt

job3:
stage: stage3
script:
- cat test.txt
dependencies:
- job1
- job2

我们注意到 job1job2 都为文件 test.txt 提供了相同的引用。

现在,如果我同时运行这两个作业,最近成功的作业将存储最新的工件,以便在 job3 中可用。在此示例中,job1 花费了 87 秒,而 job2 花费了 90 秒。 job3 的输出证实了这一点

enter image description here

在 UI CI/CD --> Pipelines 上,您仍然可以下载每个作业工件

enter image description here

关于Gitlab CI : is it possible to access artifacts from previous jobs that stores them in the same path?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66815193/

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