GitLab Runner - How to allow only one Pipeline run at a time

Viewed 10148

I am new to GitLab and facing a problem where if I trigger two pipelines at the same time on same gitlab-runner, they both run in parallel and results in failure. What I want is to limit the run to one pipeline at a time and others in queue.

I have set the concurrent = 1 in config.toml and restarted the runner but it didn't help. My ultimate goal is to prevent multi-pipeline run on the runner.

Thanks.

2 Answers

Set resource_group in the Job, and give a unique name for all other tasks that should be blocked.

Example from the documentation:

deploy-to-production:
  script: deploy
  resource_group: production

Set the limit keyword in the runners section of your configuration to 1.

limit :

Limit how many jobs can be handled concurrently by this token. 0 (default) simply means don’t limit

and restart you runner

Related