Continuous Integration

Continuous integration allows you to run scripts such as unit tests on every push to the repository.

The scripts can either run on the shared runners that isginf provides with the GitLab service or you can run them on your own build host.

More information can be found here.

Shared Runner

To use continuous integration with the installed shared runners just enable the Builds feature of your project and add a file .gitlab-ci.yml to the top level of the repository. The following example is a good starting point:

before_script:
  - <shell_line>

stages:
  - build
  - test
  - deploy

job1:
  stage: build
  script:
    - <shell_line>
  tags:
    - <tag_of_shared_runner>

Please note that:
  • Commands from the repository can be used in <shell_line> if they are preceded with ./.
  • If you need to install additional packages use yum install -y <some_package> in the the before_script section.
  • The runner for each job is selected through the tags.

Shared runners are a shared resource. There is the possibility that other users slow down or even block the whole build process.

Own Build Host

To use your own build host follow the official instructions for setting your host.

To register one or more runners on your build host with your project run the following command as =root on your host:

gitlab-runner register

on your host and give the following answers:

  • gitlab-ci coordinator URL: https://gitlab.inf.ethz.ch/ci
  • gitlab-ci token for this runner: The token that can be found for Specific Runners in the Runners settings.
  • shell or a docker image: If you build host has the build environment installed then you can use shell.

When done run the following command as root on your host to restart the runner service:

# gitlab-runner restart

To use your runner for a project follow the above instructions for shared runners but select the registered runner under Specific Runners. We also recommend to disable the shared runners in the Runner settings of the project make sure only your runners match the tags of the jobs.

Are these instructions wrong, incomplete or outdated? Are they not helpful?
Please let us know.

Page URL: https://isg.inf.ethz.ch/bin/view/Main/HelpVersionControlGitLabCI
2019-07-17
© 2019 Eidgenössische Technische Hochschule Zürich