Giter Club home page Giter Club logo

rahti-gitlab-runner's Introduction

Intention

Gitlab proposes to deploy the runner using Helm or GitLab operator. It requires additional permissions. This approach problematically to use in OpenShift Container Platform if you don't have cluster admin privileges. Moreover, default images are not designed to run using an arbitrarily assigned user ID. This repo contains dockerfiles and an OpenShift template which allows you to deploy the GitLab runner in OCP with minimum efforts.

In addition to the OpenShift related adoptions needed to run the Gitlab runner, we require some specific configuation before we can run it in Rahti/Rahti-int. Those additional configuations are included in this repo.

NOTE: This work has been mostly adopted from: https://github.com/RedHatQE/ocp-gitlab-runner.

Usage

Quick Rahti-int/Rahti Specifc Usage Instructions

  1. Build and push the required images (Optional, otherwise a pre-built image will be used):
docker build -t some_repo/some_image_name:some_tag -f runner.Dockerfile .
docker push some_repo/some_image_name:some_tag

docker build -t some_repo/some_other_image_name:some_tag -f helper.Dockerfile .
docker push some_repo/some_other_image_name:some_tag
  1. Deploy the runner by processing the template:
oc process -f rahti-gitlab-runner-template.yaml \
-p NAME="some-name" \
-p GITLAB_HOST="gitlab.ci.csc.fi" \
-p REGISTRATION_TOKEN="$(echo -n <some_token> | base64)" \
-p GITLAB_RUNNER_VERSION="v14.9.1" \
-p TLS_CA_CERT="$(openssl s_client -showcerts -connect gitlab.ci.csc.fi:443 -servername gitlab.ci.csc.fi < /dev/null 2>/dev/null | openssl x509 -outform PEM | base64)" \
-p TEMPLATE_CONFIG_FILE="$(cat config.template.toml)" | oc create -f -

Note: Replace <some_token> with a token obtained in Settings > CI/CD. Otherwise the Pod will enter in crashloopbackoff and never start.

  1. Clean up after usage
oc delete secret,cm,sa,rolebindings,bc,is,deployment -l app=some-name

Contents

runner.Dockerfile

This image based on registry.access.redhat.com/ubi8-micro. It contains gitlab-runner executable that talks to GitLab CI and spawns builder pods via kubernetes executor.

helper.Dockerfile

GitLab's helper image with gitlab-runner-helper executable. The image based on registry.access.redhat.com/ubi8-minimal.

ocp-gitlab-runner-template.yaml

An OpenShift template that creates required objects and deploys the runner with minimum efforts. Just provide a name, GitLab instance host, runner's registration token and desired number of concurrent build pods.

Parameters

  • NAME

    description: Name of DeploymentConfig and value of "app" label.

    required: true

  • GITLAB_HOST

    description: Host of a GitLab instance.

    required: true

  • GITLAB_RUNNER_VERSION

    description: GitLab runner version, e.g "v14.9.1".

    required: false

  • REGISTRATION_TOKEN

    description: Runner's registration token. Base64 encoded string is expected.

    required: true

  • CONCURRENT

    description: The maximum number of concurrent CI pods.

    required: true

  • RUNNER_TAG_LIST

    description: Tag list.

    required: false

  • GITLAB_BUILDER_IMAGE

    description: A default image which will be used in GitLab CI.

    required: false

  • TLS_CA_CERT

    description: A certificate that is used to verify TLS peers when connecting to the GitLab server. Base64 encoded string is expected.

    required: false

  • TEMPLATE_CONFIG_FILE

    description: A patch for config.toml which will be applied during runner registration. Details in https://docs.gitlab.com/runner/register/#runners-configuration-template-file

    required: false

  • RUNNER_IMG

    description: An Image containing the gitlab-runner executable that is used to communicate with GitLab CI.

    required: true

  • HELPER_IMG

    description: An image with a special compilation of GitLab Runner binary. It contains only a subset of available commands, as well as Git, Git LFS, SSL certificates store.

    required: true

rahti-gitlab-runner's People

Contributors

lvarin avatar jussienko avatar tdeneke avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.