[英]enable merge request pipeline only on master
I am lots of branches in my repo, now I want to add MR pipeline for the master branch, and enable the Merge checks
and Pipelines must succeed
optional.我的仓库中有很多分支,现在我想为主分支添加 MR 管道,并启用
Merge checks
和Pipelines must succeed
可选。 unfortunately the repo have so many branches that I don't want to create .gitlab-ci.yml
for them one by one.不幸的是,repo 有这么多分支,我不想一一为它们创建
.gitlab-ci.yml
。 but as I have enabled the options for merge check, MR to the branched are stuck because they are not passed pipeline(no pipeline is configured for the branch).但是当我启用了合并检查的选项时,分支的 MR 被卡住了,因为它们没有通过管道(没有为分支配置管道)。 So anyone can help me out?
所以任何人都可以帮助我吗?
Can you also paste an snipped of your .gitlab-ci.yml
file?您还可以粘贴
.gitlab-ci.yml
文件的片段吗?
Hoping you must have tried this to your stages?希望你一定在你的舞台上尝试过这个?
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == 'master'
This basically will run only for a merge request to the master branch.这基本上只会对主分支的合并请求运行。 And this chunk should be inside the source branch .gitlab-ci.yml
这个块应该在源分支.gitlab-ci.yml
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.