We just migrated from Jenkins to GitLab-CI and have a pipe with multiple stages like
build -> test 1 -> test 2 -> test 3 -> deploy
Artifacts are produced during the build stage and the same are used during the subsequent stages and the total time for a pipe to run is ~2hrs.
Our setup is in such a way that if another pipe for the same branch starts parallelly then it overwrites the existing artifacts created by the previous pipe and the previous pipe fails.
Lets say we have a pipe #1 for the branch master running already and another pipe #2 starts for master after 30 mins, then the artifact of pipe #1 are removed and it fails.
In case of Jenkins we were able to restrict parallel pipes using the below configuration :
options {
disableConcurrentBuilds()
}
But we are not able to find a similar configuration for GitLab-CI.
We already tried the solution suggested by '@Simon Schrottner' in the comments section but it works only at a job level but not at a pipeline level, we added the resource_group for all the jobs in the pipe as shown below :
build:
script: echo "build"
resource_group: "group1"
test:
script: echo "test"
resource_group: "group1"
deploy:
script: echo "deploy"
resource_group: "group1"
Note that we run all the jobs in the pipe sequentially.
But with this setup instead of waiting for the first pipe to finish all the jobs, the jobs from both the pipes were executed randomly as shown below
Expected : Pipe #2 wait till all the stages of Pipe #1 is finished
Pipe #1 : build(started) -> test -> deploy
Pipe #2 : build(waiting) -> test -> deploy
Pipe #1 : build(finished) -> test(started) -> deploy
Pipe #2 : build(waiting) -> test -> deploy
Pipe #1 : build(finished) -> test(finished) -> deploy(started)
Pipe #2 : build(waiting) -> test -> deploy
Pipe #1 : build(finished) -> test(finished) -> deploy(finished)
Pipe #2 : build(started) -> test -> deploy
Actual : Jobs are started randomly from each pipe
Pipe #1 : build(started) -> test -> deploy
Pipe #2 : build(waiting) -> test -> deploy
Pipe #1 : build(finished) -> test -> deploy
Pipe #2 : build(started) -> test -> deploy
Pipe #1 : build(finished) -> test -> deploy
Pipe #2 : build(finished) -> test(started) -> deploy
Pipe #1 : build(finished) -> test(started) -> deploy
Pipe #2 : build(finished) -> test(finished) -> deploy