Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Only Single GitLab CI Runner Building

I recently installed GitLab and am attempting to use GitLab CI. I successfully enabled GitLab CI in my GitLab Server and successfully installed a CI Runner (on Windows, if this is relevant). I enabled a project for the Windows CI Runner and when I commit to the repository the runner is executed and I can see the builds.

I installed a second CI Runner (on Debian) following the documentation. I can see the Debian CI Runner is registered, along with the Windows CI Runner. The Debian CI Runner has the same project assigned to it. However, when I commit to the repository only the Windows CI Runner is executed, the Debian CI Runner is not attempting to build.

What mistake have I made or what additional configuration is there to enable this? I have already tried re-registering the Debian CI Runner with no success.


Update 1: The Debian CI Runner is now executing but the Windows CI Runner is not. It seems to select only a single runner.

Update 2: Upgraded to 'GitLab CI 7.14.1 2dee1b3' but same behaviour persists.

Update 3: Added a third runner on a Scientific Linux machine. It is registered and assigned the project but only a single runner executes (currently the Debian CI Runner).


GitLab CI 7.12.0 e96755c

like image 317
hmjd Avatar asked Aug 27 '15 09:08

hmjd


1 Answers

When a build for gitlab CI is triggered, it will execute jobs listed in the .gitlab-ci.yml file. Think of these jobs as independent, concurrent steps in your build. These jobs are executed by any available runner capable of completing that job. However, where I think you're getting tripped up is that a job will only be completed once, and by the first available runner. Think of the runners as a pool of resources, not as build steps. Having multiple runners allows you to execute jobs in parallel.

If you have one job that you want to have executed each time by each runner, try using tags. E.g.:

job1:
  tags:
    - windows
  script:
    - job command 1
    - job command 2

job2:
  tags:
    - debian
  script:
    - job command 1
    - job command 2

Where job command 1 and job command 2, etc., are the steps you'd like your job to perform, and windows and debian are the tags that you'll assign to your runners. Basically you're just creating identical jobs with different tags, one job for each runner. Then, you need to make sure each runner has the tag that you specify for its job. You can do this by editing the runner in gitlab CI.

  1. Go to Runners
  2. Scroll down to "Runners activated for this project"
  3. Click on the edit symbol
  4. Add the tag to the runner
  5. Click Save

See the gitlab YAML readme for more on tags

like image 105
Dizzyspiral Avatar answered Oct 17 '22 23:10

Dizzyspiral