Disallow CI pipelines of one GitLab project to run concurrently?

走远了吗. 提交于 2021-02-18 18:49:10

问题


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.

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.

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.


回答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



来源:https://stackoverflow.com/questions/49597850/disallow-ci-pipelines-of-one-gitlab-project-to-run-concurrently

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!