GitLab Runner for CI

GitLab Runner for CI

GitLab CI involves installing one or more GitLab Runners. These runners carry out tasks as instructed by the main GitLab installation. When installing a runner, you have to select the project tags to which the runner will respond and the type of tasks ("executor") it can carry out. For example, there is a Shell executor, Docker execuctor etc.

Once GitLab runner is installed, you have to add the runner in GitLab. When adding the runner in GitLab, you can decide how GitLab schedules tasks in the runner ie. if the runner is exclusive to a project ('Specific Runner') or shared between projects ('Shared Runner) or specific to a group ('Group Runner').

This GitLab package can be used with GitLab Runner as follows.
  1. First create a new server and install GitLab Runner on it following the instructions at GitLab docs. In short:
# For ubuntu
curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh | sudo bash
sudo apt-get install gitlab-runner
  1. Get the token listed in GitLab under https://<gitlab.example.com>/admin/runners (under shared runners section).
  2. Register the runner with the token from the above step
root@localhost:~# sudo gitlab-runner register
Running in system-mode.                            
Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/):
https://gitlab.domain.com
Please enter the gitlab-ci token for this runner:
xzdZgdsXq5uSFCyAK7pP
Please enter the gitlab-ci description for this runner:
[localhost]: Shell Jobs Runner
Please enter the gitlab-ci tags for this runner (comma separated):
Whether to lock the Runner to current project [true/false]:
[true]: false
Registering runner... succeeded                     runner=xzdZgdsX
Please enter the executor: docker, docker-ssh, shell, ssh, virtualbox, docker-ssh+machine, parallels, docker+machine, kubernetes:
shell
Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded! 
  1. The Runner should now be listed under https://<gitlab.example.com>/admin/runners.
  2. Now push a .gitlab-ci.yml to your project to start using the runner.