不允许一个GitLab项目的CI管道同时运行? [英] Disallow CI pipelines of one GitLab project to run concurrently?

查看:55
本文介绍了不允许一个GitLab项目的CI管道同时运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在内部GitLab服务器上,有一个项目带有CI脚本,该脚本不容许并发执行多个管道(Kubernetes中的外部副作用).因此,如果连续两次提交而在两次提交之间的时间少于第一个管道需要完成的时间,则这两个管道将同时运行,从而导致两者均失败.

On an internal GitLab server there is one project with a CI script not tolerating concurrent execution of multiple pipelines (external side effects in Kubernetes). So if two commits are pushed in succession with less time in between than the first pipeline needs to finish, the two pipelines will run concurrently, which causes both to fail.

为CI运行程序(在多个存储库中使用一个K8s运行程序)全局设置 concurrent = 1 是不可行的,因为应该允许使用该运行程序的其他项目的管道同时运行.

Globally setting concurrent = 1 for the CI runner (one K8s runner used across multiple repos) is not practicable in that case, because pipelines of other projects using that runner should be allowed to run simultaneously.

是否可以仅对一个项目禁止CI并发?取消较旧的管道或排队较新的管道都可以.

Is it possible to disallow CI concurrency only for one project? Canceling the older pipeline or queuing up the newer one would both be OK.

推荐答案

您可以使用 limit = 1 ,如以下链接中所述

You can use limit =1 as discussed in below link

https://gitlab.com/gitlab-org/gitlab-ce/issues/18224

concurrent = 3 // Attribute that limits a number of projects
check_interval = 0
[[runners]]
  limit = 1 // Attribute that limits quantity job by runners
  name = "test-ci"
  url = "https://gitlab.com/ci"
  token = "38274bf1655a0f48d72b15815a83d4e6a85689"
  executor = "shell"
  [runners.cache]

[[runners]]
  limit = 1
  name = "teste2"
  url = "https://gitlab.com/ci"
  token = "38274bf1655a0f48d72b15815a83d4e6a85689"
  executor = "shell"
  [runners.cache]

在您的情况下,不要使用共享运行器,而要使用项目特定的运行器,这样其他项目就不会受到影响

Instead of using a shared runner, use a project specific runner in your case, so other projects are not impacted

这篇关于不允许一个GitLab项目的CI管道同时运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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