问题
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