GitLab Runner Operator on Power

Sneha Gaonkar
4 min readMar 25, 2022

GitLab is a single application DevOps platform that is designed to manage the entire software development lifecycle. It enables professionals to perform all the tasks in a project — from project planning and source code management to monitoring and security. Additionally, it allows teams to collaborate and build better software.

With GitLab gaining popularity in the recent years with the various features it provides, its demand has increased. Several GitLab customers use IBM Power, which leads to the need for GitLab on IBM Power Architecture. The GitLab Runner includes support for Linux on IBM Power and provides built binary files and images for GitLab Runner from GA 14.3 release onwards. Whereas GitLab Runner operator includes support for IBM Power from v1.6.0 onwards. The latest version of GitLab Runner operator v1.8.0 is now certified by RedHat and listed on OperatorHub.

This tutorial shows how to install GitLab Runner operator on Linux for IBM Power and test its basic features.

Pre-requisites

  • A ppc64le OCP cluster for deploying the GitLab Runner Operator

You can deploy a Red Hat OpenShift cluster on IBM Power Systems Virtual Servers using steps in this article: https://developer.ibm.com/components/ibm-power/tutorials/install-ocp-on-power-vs/

  • A GitLab project where you will be creating the GitLab runners to run the pipelines

Installing GitLab Runner Operator from OperatorHub

  • Installing GitLab Runner Operator

Install GitLab Runner operator via OperatorHub on your ppc64le cluster.

Within few seconds, it will get installed:

Create Runner

  1. Create a namespace for your project.
oc new-project gitlab-runner-system

2. Create the secret file with your GitLab project’s runner token:

Go to your Gitlab project’s Settings > CI/CD > Expand Runners > Copy your ‘Registration token”

cat > gitlab-runner-secret.yml << EOF
apiVersion: v1
kind: Secret
metadata:
name: gitlab-runner-secret
type: Opaque
stringData:
runner-registration-token: REPLACE_ME # your project runner secret
EOF
oc apply -f gitlab-runner-secret.yml

3. Create the Runner from CRD

Create Custom Resource Definition (CRD) file with the following information. The tags value must be openshift for the job to run.

cat > gitlab-runner.yml << EOF
apiVersion: apps.gitlab.com/v1beta2
kind: Runner
metadata:
name: gitlab-runner
spec:
gitlabUrl: <YOUR GITLAB INSTANCE URL>
buildImage: alpine
token: gitlab-runner-secret
tags: openshift
EOF
oc apply -f gitlab-runner.yml

Confirm that GitLab Runner is installed by running:

oc get runnersNAME               AGE
gitlab-runner 14d

Verify that runner is listed in “Specific runners” list for the Gitlab project. In your Gitlab project, go to Settings > CI/CD > Expand Runners :

3. Configuring code to use the new Runner

Modify the tag field in .gitlab-ci.yaml file to use the newly available runner. Link to sample repository used in this tutorial- https://gitlab.com/skanekar1/myfirstproject/

A new build will now use the ‘openshift’ runner. It will create a new pod to run the build:

Done! You have now configured your GitLab project to use GitLab Runner for Power. The GitLab runner operator will manage the lifecycle of your runners.

Thank you for reading. I hope you found this tutorial helpful :)

--

--