覆盖外部gitlab.yml文件
假设我们有一个.gitlab-ci.yml
文件,该文件在common.gitlab-ci.complete.yml
file:
include: common.gitlab-ci.complete.yml
假设common.gitlab-ci中。
stages:
- build
- unit-test
- mutation-test
-Test 阶段?会之类的是:
include: common.gitlab-ci.complete.yml
stages:
- build
#- unit-test
#- mutation-test
这些阶段
是否会覆盖common.gitlab-ci.complete.yml
文件中的一个?
Suppose we have a .gitlab-ci.yml
file that reads in a common.gitlab-ci.complete.yml
file:
include: common.gitlab-ci.complete.yml
Suppose that common.gitlab-ci.complete.yml
has the following stages:
stages:
- build
- unit-test
- mutation-test
In the .gitlab-ci.yml
file, how do we ignore the unit-test
and mutation-test
stages? Would it be something like:
include: common.gitlab-ci.complete.yml
stages:
- build
#- unit-test
#- mutation-test
Would these stages
override the one in the common.gitlab-ci.complete.yml
file?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
(我尚未检查此代码的准确性。将其视为伪代码。)
您要求在舞台上删除所有作业。如果您查看
的文档>
include: 关键字,您会注意到YAML始终与您当前的CI脚本合并。因此,不,您不能只添加诸如“在A阶段中禁用所有工作”之类的声明。这是一个主意...回想一下
因此,您可以做的就是添加一种机制,以使该阶段中的所有工作都禁用。然后舞台也将消失。该机制可能正在检查。
因此,如果您编写
common.gitlab-ci.complete.yml
使用模板检查变量以禁用工作...那么也许您的顶级
.gitlab-ci.yml < /code>将简单地在其 global
变量中设置该已知变量
类似的部分:(I have not yet checked this code for accuracy. Treat it as pseudocode.)
You're asking to remove all jobs in a stage. If you look at the documentation for the
include:
keyword, you'll note that the YAML is always merged with your current CI script. So no, you can't just add a statement like "Disable all jobs in stage A".Here's an idea... recall that
So what you could do is add a mechanism for disabling all jobs in that stage. Then the stage will disappear as well. That mechanism might be checking a variable in
rules
.So if you wrote the
common.gitlab-ci.complete.yml
with templates that check a variable to disable the job...Then maybe your top-level
.gitlab-ci.yml
would simply set that known variable in its globalvariables
section like this: