Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to use multiple gitlab runners for one CI build?

There is a project which has a lot of tests, and running them all takes about 20 minutes. Unfortunately, it is not possible to parallel them inside one gitlab runner. I wonder if there are any good practices to start multiple gitlab runners with the same environment but different test suits?

like image 563
t1maccapp Avatar asked May 18 '16 06:05

t1maccapp


1 Answers

If you can split the test suit into several parts, you can create equal number of jobs in the same stage (test). Jobs in the same stage are run in parallel but jobs in the next stage will start after the jobs of the previous stage complete. They will run in parallel even if you have only one runner. Let's assume this test case:

stages:
  - test

testsA:
  stage: test
  script:
    - sleep 60
    - echo 'Test set A done'

testsB:
  stage: test
  script:
    - sleep 30
    - echo 'Test set B done'

You will see that they are running at the same time and test A will complete after test B.

Adjust the runners' settings (/etc/gitlab-runner/config.toml) checking for 2 options:

  • concurrent = the total number of jobs run in parallel across all runners
  • limit (set for each runner) = the number of jobs run in parallel by one particular runner

Note: I haven't tested if a project with multiple runners, each of them having limit set to 1, would run these jobs using different runners. However, I assume it works this way.

like image 187
tmt Avatar answered Oct 16 '22 19:10

tmt