GitLab Runner
GitLab Runner is an application that works with GitLab CI/CD to run jobs in a pipeline.
Runners can be used to
- Automate running of linting and tests
- Publish static HTML pages
- Compile and tag code releases
- Publish Helm repositories
ICE Connect GitLab provides a public runner for all projects. The official GitLab.com also provides public runners but with a limited number of minutes each month. You may want to install a private runner if
- Using secret caches or passwords
- Performing jobs requiring extra resources
- Using official GitLab and you need more minutes than you get for free
Installation
Install the app through Rancher.
Your namespace should have a Container Default Resource Limit set. CPU Reservation 100m
and Memory Limit/Reservation 128Mi
should suffice. Do not set a CPU Limit.
Configure
GitLab Server
Point this to a running GitLab deployment, e.g.
https://gitlab.ice.ri.se/
https://gitlab.com/
Registration Token
Used by GitLab server to identify new runners.
For project scoped runner: Project ➡ Settings ➡ CI/CD ➡ Runners ➡ Project runners
For public runners: Admin Area ➡ CI/CD ➡ Runners ➡ New instance runner
Runner Configuration
This TOML file describes what resources each spawned runner will use.
[[runners]]
[runners.kubernetes]
namespace = "{{.Release.Namespace}}"
image = "ubuntu:16.04"
cpu_request = "500m"
memory_limit = "8Gi"
memory_request = "8Gi"
[runners.cache]
Type = "s3"
Path = "runner"
Shared = true
[runners.cache.s3]
ServerAddress = "s3.ice.ri.se"
AccessKey = "YOUR_ACCESS_KEY"
SecretKey = "YOUR_SECRET_KEY"
BucketName = "YOUR_BUCKET_NAME"
BucketLocation = "none"
Insecure = false
AuthenticationType = "access-key"
The [runners.cache]
section can be deleted if no caching is needed.
Official documentation about Runner Configuration:
Read official documentation about Configuring GitLab Runner using the Helm Chart.
Then read about Using cache with configuration template to use S3 storage.
If you want to use tags for job control, read this.
The page Using the GitLab Runner chart lists the settings you can use in the values.yaml
file in the Helm Chart:
Official repositories
GitLab Runner Helm Chart repository
GitLab Runner Service repository
Updating the chart
-
Find the latest official release tag.
-
Clone the Rancher catalog repo:
-
Edit the
Chart.yaml
file to use the latest tag. -
Run
helm dependency update
to download the newcharts/gitlab-runner-0.XX.0.tgz
-
Commit and push. Refresh the catalog in Rancher.
Before updating the app deployment, pause the runner in GitLab, to make sure no jobs are running.