How do I correctly configure Gitlab Runners with S3/Minio as a distributed cache?

Viewed 959

I am running Gitlab Runners on Openshift, and they are picking up jobs correctly. However, when running the job, the cache should be configured to use s3 caches, with a local minio service serving as s3 for the distributed cache. However, when running the job, the runner appears to ignore the setup and attempt to use a local cache (and indeed gets a permission denied error when trying to create it locally?)

config.toml:

concurrent = 8
check_interval = 0
[[runners]]
  name = "GitLab Runner"
  url = "https://gitlab.com/"
  token = "XXX"
  executor = "kubernetes"
  builds_dir = "/tmp/build"
  environment = ["HOME=/tmp/build"]
  cache_dir = "/tmp/cache"
  [runners.kubernetes]
    namespace = "gitlab-runners"
    privileged = false
    host = ""
    cert_file = ""
    key_file = ""
    ca_file = ""
    image = ""
    cpus = ""
    memory = ""
    service_cpus = ""
    service_memory = ""
    helper_cpus = ""
    helper_memory = ""
    helper_image = ""
  [runners.cache]
    Type = "s3"
    Shared = true
    Path = "gitlab"
      [runners.cache.s3]
        ServerAddress = "minio-service"
        AccessKey = "XXX"
        SecretKey = "XXX"
        BucketName = "gitlab-runner"
        BucketLocation = "eu-west-1"
        Insecure = true
        

Cache job output:

Initialized empty Git repository in /tmp/XXXX/XXX/.git/
Created fresh repository.
Checking out e57da922 as develop...
Skipping Git submodules setup
Restoring cache
00:01
Checking cache for develop-1...
FATAL: mkdir ../../../../cache: permission denied  
Failed to extract cache
Executing "step_script" stage of the job script
02:02
$ npm install
added 1966 packages, and audited 1967 packages in 2m
found 0 vulnerabilities
Saving cache for successful job
00:01
Creating cache develop-1...
node_modules/: found 44671 matching files and directories 
FATAL: mkdir ../../../../cache: permission denied  
Failed to create cache
Cleaning up file based variables
00:00
Job succeeded

Second job (pulling from cache output):

Restoring cache
00:00
Checking cache for develop-1...
FATAL: file does not exist                         
Failed to extract cache
Executing "step_script" stage of the job script
0 Answers
Related