gpt4 book ai didi

gitlab-ci - 跨越多个阶段的 CI 作业

转载 作者:行者123 更新时间:2023-12-03 17:04:13 28 4
gpt4 key购买 nike

如何创建跨越多个阶段的 CI 作业以提高并行性?
如下图所示:
Diagram showing one process spanning multiple stages
这个想法是slow_build应该最早开始build ,但是 test不依赖它,所以 test应该可以尽快启动build已经完成了。
(请注意,这是一个简化:每个阶段都有多个并行运行的进程,否则我可以将 buildtest 捆绑在一起。)

最佳答案

从 Gitlab 12.2 版开始,这现在是可能的。通过添加关键字 needs对于依赖于其他作业的作业,阶段现在可以同时运行。 needs 的完整文档关键字在这里,但文档中的示例如下:https://docs.gitlab.com/ee/ci/yaml/#needs

linux:build:
stage: build

mac:build:
stage: build

lint:
stage: test
needs: []

linux:rspec:
stage: test
needs: ["linux:build"]

linux:rubocop:
stage: test
needs: ["linux:build"]

mac:rspec:
stage: test
needs: ["mac:build"]

mac:rubocop:
stage: test
needs: ["mac:build"]

production:
stage: deploy
lint作业不需要任何东西,它会立即运行,就像 linux:build 一样和 mac:build .但是,如果 linux:build结束前 mac:build然后两者 linux:rspeclinux:rubocop可以开始,甚至在 mac:build 之前和 build阶段完成。
像往常一样,没有 needs关键字, production作业要求在开始之前完成所有先前的作业。
使用时 needs在您的管道中,您还可以在管道 View 中查看作业的有向无环图。有关更多信息,请访问: https://docs.gitlab.com/ee/ci/directed_acyclic_graph/index.html

关于gitlab-ci - 跨越多个阶段的 CI 作业,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50045129/

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