Gitlab Runner Cache using Linode Object Storage

Linode offers 250GB of object storage for 5$ a month. Using this we can create a cache for use in Gitlab Runner. This allows us proper access to a cache when running our own runners.

Setup Linode Object Storage

First need to setup your Linode Object Storage. Using this will setup the base 5$/month price and you get 250GB of storage.

Setup Linode Object Storage Bucket

Make a bucket for the cache.

Ex. my-gitlab-runner-cache

Setup Access keys for Linode Object Storage

Setup limited access keys for your object storage.

Setup Gitlab Runner

Setup Gitlab runner where you want to run the jobs.

Configure runner.cache

For gitlab runner, you will need to configure the cache type. Here we want to set it to s3.

Type = s3

Configure runner.cache.s3 to use Linode Object Storage

	ServerAddress = ""
	AccessKey = "LINO**************"
	SecretKey = "SECR*********************************"
	BucketName = "gitlab-runner-cache"
	BucketLocation = "us-east-1"

All Together

My /etc/gitlab-runner/config.toml roughly.

  name = "MyRunner"
  url = ""
  token = "*******************"
  executor = "docker"
    Type = "s3"
			ServerAddress = ""
			AccessKey = "LINO**************"
			SecretKey = "SECR*********************************"
			BucketName = "my-gitlab-runner-cache"
			BucketLocation = "us-east-1"

    tls_verify = false
    image = "alpine:latest"
    privileged = false
    disable_entrypoint_overwrite = false
    disable_cache = false

Register Gitlab Runner

Start Gitlab Runner

sudo systemctl start gitlab-runner

If you want to start on boot you can use enable.

sudo systemctl enable gitlab-runner


Should end up something like this.

Restoring cache
Checking cache for my-cache-1...
FATAL: file does not exist                         
Failed to extract cache
Saving cache for successful job
Creating cache my-cache-1...
Uploading to https://******/project/***/my-cache-1 
Created cache


If you see 403, your access keys are not working.

If you see 404, it means it is missing (but should create it properly).

Use log_level = "debug" in gitlab-runner/config.toml to see more info on what’s happening.