I've setup gitlab (via helm chart 5.2.3 / gitlab ce 14.2.3) in my kubernetes cluster (1.21) on a bare-metal ubuntu machine.
As docker >= 19 has enabled TLS as default I have to add some configuration to get dind in my CI working (to get access to docker).
.gitlab-ci.yml
variables:
DOCKER_DRIVER: overlay2
DOCKER_HOST: tcp://localhost:2376
DOCKER_TLS_CERTDIR: "/certs"
DOCKER_TLS_VERIFY: 1
DOCKER_CERT_PATH: "$DOCKER_TLS_CERTDIR/client"
values.yaml
gitlab-runner:
runners:
privileged: true
config: |
[[runners]]
[runners.kubernetes]
image = "ubuntu:20.04"
privileged = true
[[runners.kubernetes.volumes.empty_dir]]
name = "docker-certs"
mount_path = "/certs/client"
medium = "Memory"
But with this I can't use cache anymore:
install dependencies:
stage: dependencies
script:
- npm ci
cache:
key: ${CI_COMMIT_REF_SLUG}
policy: push
paths:
- node_modules/
results in:
Creating cache main...
node_modules/: found 49948 matching files and directories
No URL provided, cache will be not uploaded to shared cache server. Cache will be stored only locally.
Created cache
The logs give me:
ERROR: Could not create cache adapter error=cache factory not found: factory for cache adapter "" was not registered
So I tried to configure the cache:
gitlab-runner:
runners:
privileged: true
config: |
[[runners]]
[runners.kubernetes]
image = "ubuntu:20.04"
privileged = true
[runners.cache]
Type = "s3"
Path = ""
Shared = false
[runners.cache.s3]
ServerAddress = "minio.domain.com"
BucketName = "gitlab-runner"
BucketLocation = "none"
Insecure = false
[[runners.kubernetes.volumes.empty_dir]]
name = "docker-certs"
mount_path = "/certs/client"
medium = "Memory"
which is nearly working, but the path is wrong:
Creating cache main...
node_modules/: found 49948 matching files and directories
Uploading cache.zip to https://minio.domain.com/gitlab-runner/runner/yC3_5Zz4/project/4/main
FATAL: received: 400 Bad Request
Failed to create cache
Before configuring the TLS (an with that there is no docker access) the working output was:
Creating cache main...
node_modules/: found 49948 matching files and directories
Uploading cache.zip to https://minio.domain.com/runner-cache/gitlab-runner/project/4/main
Created cache
So how do I have to setup the cache correctly?