禁止一个GitLab项目的CI管道同时运行?

时间:2018-04-01 12:03:47

标签: continuous-integration gitlab

在内部GitLab服务器上,有一个项目具有CI脚本,不能容忍多个管道的并发执行(Kubernetes中的外部副作用)。因此,如果连续推送两个提交,其间的时间比第一个管道需要完成的时间短,则两个管道将同时运行,这会导致两个管道都失败。

在这种情况下,为CI运行器(在多个repos中使用一个K8s运行器)进行全局设置concurrent = 1是不切实际的,因为应该允许使用该运行器的其他项目的管道同时运行。

是否可以仅针对一个项目禁用CI并发?取消旧的管道或排队更新的管道都可以。

1 个答案:

答案 0 :(得分:1)

您可以使用以下链接

中讨论的limit =1

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]

在您的案例中使用特定于项目的跑步者,而不是使用共享跑步者,因此其他项目不受影响