GitLab Runner on WebHS Cloud

tutorial Aug 08, 2018

GitLab has built-in continuous integration to allow you to run a number of tasks as you prepare to deploy your  software. Typical tasks might be to build a software package or to run  tests as specified in a YAML file. These tasks need to run by something,  and in GitLab this something is called a Runner; an application that processes builds.

Let's explore how to install and manage the GitLab Runner on WebHS Cloud service.

Prerequisites

GitLab Runner implements a number of executors that can be used to run your builds in different scenarios. For this tutorial, we will use Docker, but you can check on Executors page more information.

You can buy a Cloud Server with Docker pre-installed or just buy with only Ubuntu / CentOS installed and prepare yourself the Docker.

Install Docker Service

Access to the server and install Docker

curl -sSL https://get.docker.com/ | sh

Check if Docker is correctly installed

docker info

This should show a bunch of information about the Docker version, the  number of images and containers, etc. With that set, we're ready to  install GitLab Runner.

Install the GitLab Runner


GitLab provides the right repositories to install all the dependencies for this service.

curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh | sudo bash

As soon as the script show the message "The repository is setup! You can now install packages.", you are ready to install it..

apt-get install gitlab-runner

Register the GitLab Runner

Project register / activate runner

At this point, GitLab Runner is installed and we are ready to register on our GitLab instance / project.

gitlab-runner register

All the information that you need on this interactive command is on GitLab runner section.

Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/):
https://gitlab.com/ci

Please enter the gitlab-ci token for this runner:
1yTPjhcVP9fi238f

Please enter the gitlab-ci description for this runner:
If you have multiple Runners and want something to remind you what the Runner is about. 

Please enter the gitlab-ci tags for this runner (comma separated):
You can use tags in your .gitlab-ci.yml to limit jobs to specific Runners. For example: webhs,cloud,runner,testing

Please enter the executor: docker, shell, docker+machine, kubernetes, docker-ssh, parallels, ssh, virtualbox, docker-ssh+machine:
docker

Please enter the default Docker image (e.g. ruby:2.1):
php:latest (example)


At the end of this process, you can check that the Runner is registered with:

gitlab-runner list