为 Gitlab 中的每个提交禁用管道,并且仅在打开合并请求时运行它 [英] Disable pipeline for every commit in Gitlab and only run it on open merge request

查看:41
本文介绍了为 Gitlab 中的每个提交禁用管道,并且仅在打开合并请求时运行它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

CI 管道在我工作中的 Gitlab 存储库中的每次提交上运行.有没有办法禁用它,只在对主分支的开放合并请求上运行 CI 管道?

The CI pipeline runs on every commit in my Gitlab repository at work. Is there way to disable that and only run the CI pipeline on an open merge request to the master branch?

推荐答案

目前没有配置选项可以做到这一点.以下是一些可用于禁用"管道构建的内容.

There is currently no configuration option to do that. Here are some things that can be used to "disable" a pipeline build.

  • 在提交消息中添加 [ci skip] 不会在推送时触发管道.
  • 对管道内的所有作业使用 exceptonly 选项.在这种情况下,为避免重复,您可以使用 Anchors.
  • Adding [ci skip] inside the commit message will not trigger a pipeline on push.
  • Using except and only options on all jobs inside the pipeline. To avoid duplication in this case, you can use Anchors.

更新:GitLab 11.7

推送到 GitLab 时,您可以通过将 ci.skip 选项传递给推送命令来跳过触发管道:git push -o ci.skip

When pushing to GitLab you can skip triggering a pipeline by passing ci.skip option to the push command: git push -o ci.skip

这篇关于为 Gitlab 中的每个提交禁用管道,并且仅在打开合并请求时运行它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆