如何在不使用工件的情况下根据前一阶段的结果来控制舞台剧?

How to control a stage play based on previous stage result without using artifacts?

我们有一个项目托管在内部 Gitlab 安装上。

该项目的管道有 3 个阶段:

objective 隐藏或禁用部署阶段当测试失败

问题是我们不能使用工件,因为每次我们的机器重新启动时它们都会丢失。

我的问题:是否有替代工件的解决方案来完成此任务?

使用过的 .gitlab-ci.yml 看起来像这样:

stages:
    - build
    - tests
    - deploy

build_job:
    stage: build
    tags:
        # - ....
    before_script:
        # - ....
    script:
        # - ....
    when: manual
    only:
        - develop
        - master

all_tests:
    stage: tests
    tags:
        # - ....
    before_script:
        # - ....
    script:
        # - ....
    when: manual
    only:
        - develop
        - master


prod:
    stage: deploy
    tags:
        # - ....
    script:
        # - ....
    when: manual
    environment: prod

我想你可能误解了 built-in CI 的目的。目标是在每次提交或至少每次推送时都自动构建和测试。将所有任务设置为手动执行,与 Jenkins 或 Bamboo 等外部 CI 工具相比,您几乎没有任何优势。您现在在本地执行目标的唯一优势是在中心位置具有可见性。

也就是说没有办法有条件地显示或隐藏 CI 任务,因为这违背了基本思想。如果你坚持你的想法,你可以查看前面阶段的工件并在出现问题时中止手动执行。

The problem is that we can't use artifacts because they are lost each time our machines reboot

AFAIK 工件被上传到 master 而不是保存在 runner 上。将您的工件从一个阶段传递到另一个阶段应该没问题。

顺便说一下,when 的默认值是 on_success,这意味着 仅当前面阶段的所有构建都成功时才执行构建。