GitLab-Runner on Power

Image Credit : https://about.gitlab.com/press/

GitLab is a web-based Git repository which offers an end-to-end approach to manage the whole workflow of a project. Like GitHub, it offers features for issue tracking and project management. Additionally, it is designed to help manage the entire software development lifecycle. These additional features include managing the sharing of code between different team members, bug tracking, wiki space and Continuous Integration/Deployment pipeline.

GitLab for Power!

Currently GitLab does not build/provide resources for the ppc64le architecture. Hence, we need to build our own version to get started. Our objective is to build GitLab-Runner for Power and test it to ensure that the basic features of GitLab are working as expected on ppc64le.

Building GitLab-Runner for Power

Pre-requisites:

  • IBM Power resource to build the GitLab-Runner

You can use the PowerVS service at IBM Cloud or Minicloud to get your ppc64le virtual machine. This example uses a RHEL 8.3 ppc64le VM.

  • Install dependencies and Go runtime
yum install mercurial wget makeyum groupinstall 'Development Tools'git clone https://github.com/rpsene/goconfig.gitcd ./goconfigsource ./go.sh install
  • Docker Engine
mkdir /root/docker; cd /root/dockerwget https://oplab9.parqtec.unicamp.br/pub/ppc64el/docker/version-19.03.7/centos/docker-ce-19.03.7-3.el7.ppc64le.rpmwget https://oplab9.parqtec.unicamp.br/pub/ppc64el/docker/version-19.03.7/centos/docker-ce-cli-19.03.7-3.el7.ppc64le.rpmwget http://repos.del.extreme-ix.org/epel/7Server/ppc64le/Packages/c/containerd-1.2.4-1.el7.ppc64le.rpmyum install docker-ce-cli-19.03.7-3.el7.ppc64le.rpm docker-ce-19.03.7-3.el7.ppc64le.rpm containerd-1.2.4-1.el7.ppc64le.rpmservice docker start
  • GitLab Runner sources
go get gitlab.com/gitlab-org/gitlab-runner

Steps to build and install GitLab Runner:

  1. Build GitLab Runner
vi /etc/docker/daemon.json and add 
{
“experimental”: true
}
service docker restart
git clone https://gitlab.com/soniagarudi/gitlab-runner
cd ./gitlab-runner/ && git checkout ppc-support
make deps
make runner-and-helper-bin-host package

“make runner-and-helper-bin-host package” builds the following artifacts in the out folder:

  • gitlab-runner and gitlab-runner-helper binaries for the host architecture
  • deb and rpm packages
  • gitlab-runner-helper image and helper-image prebuilt tar file for the host machine

2. Install GitLab-Runner

Use the rpm package to install docker -

yum localinstall out/rpm/gitlab-runner_ppc64le.rpm

These steps are also available here and can be modified accordingly to build on any arch/OS. We have built and hosted the above-mentioned artifacts for the latest GitLab version and can be downloaded from the IBM domain here. The helper image is also available in the quay repository. Once the installation is complete, you can go ahead and register the runner.

Registering a runner

Let’s test the GitLab runner for Power using the Docker executor:

  1. Create a project

Firstly, you will need to create an account on https://gitlab.com/. Once you have an account, you can create a project using the steps here. Link to sample repository used in this tutorial- https://gitlab.com/soniagarudi/firstproject

2. Navigate to GitLab CI Setting -> CI/CD -> Expand Runners section to view the GitLab instance URL and token which will be used to register the runner.

3. Register Runner

#gitlab-runner register
Runtime platform arch=ppc64le os=linux pid=378397 revision=3574bc9c version=13.12.0~beta.23.g3574bc9c
Running in system-mode.Enter the GitLab instance URL (for example, https://gitlab.com/):
https://gitlab.com/
Enter the registration token:
jhNgbPV9-zMskExYSs31
Enter a description for the runner:
[sonia1.fyre.ibm.com]: ppc64le docker executor for power
Enter tags for the runner (comma-separated):
dock-ppc
Registering runner… succeeded runner= zz1vnEJW
Enter an executor: custom, docker-ssh, docker+machine, kubernetes, docker, parallels, shell, ssh, virtualbox, docker-ssh+machine:
docker
Enter the default Docker image (for example, ruby:2.6):
alpine:latest
Runner registered successfully. Feel free to start it, but if it’s running already the config should be automatically reloaded!

4. Get helper image

Note: This step is applicable only if a different machine is used to install GitLab-Runner package. Read more about helper image here.

docker pull quay.io/gitlab-on-power/gitlab-images
vi /etc/gitlab-runner/config.toml

Configure a custom image by using the helper_image configuration field:

[[runners]]   
(...)
executor = "docker"
[runners.docker]
(...)
helper_image = "quay.io/gitlab-on-power/gitlab-images"

5. Once the runner is registered successfully, it will be listed in the ‘Expand Runners’ section.

Note: Run “gitlab-runner verify” in case the runner is shown in unavailable state on the CI.

6. In your GitLab project’s “.gitlab-ci.yml” file, make sure to add the runner tag used for registering the runner in ‘tags’ field (in this example, dock-ppc).

7. When the build is triggered, it will use the registered docker executor.

Work in progress for GitLab-Runner on Power and more..!

Once Gitlab Runner has Power support, the next task would be to add Power support for Gitlab Operator! The GitLab operator is actively being developed and aims to manage the full lifecycle of GitLab and GitLab Runner instances in your Kubernetes or OpenShift container platforms.

With GitLab’s ever-increasing popularity and IBM Power architecture’s high-performance, GitLab’s availability on Power will benefit a lot of users.

If you find this tutorial useful, please let me know :)