Not possible to disable distributed caching
Summary
We are running a single instance of gitlab-runner
on our own machine with the shell
executor. We wish to use the caching feature, but only locally for this single runner instance. Therefore, we do not wish to use the S3 or Google Cloud caching adapter.
It seems to be impossible to disable distributed caching in the config, because the runner is logging errors to syslog with every job:
Could not create cache adapter error=cache factory not found: factory for cache adapter "" was not registered
Steps to reproduce
Set up a gitlab-runner instance with the shell executor. Don't configure distributed caching. Run a job that uses caching.
Relevant section of .gitlab-ci.yml
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- vendor/
Relevant section of /etc/gitlab-runner/config.toml
[[runners]]
cache_dir = "/home/gitlab-runner/cache"
[runners.cache]
Actual behavior
The job runs, and the cache feature works (locally), but an error is logged to syslog.
Expected behavior
Same, but without the error in syslog.
Relevant logs and/or screenshots
syslog
Jul 8 14:00:00 $HOSTNAME gitlab-runner[4052]: #033[31;1mERROR: Could not create cache adapter #033[0;m #033[31;1merror#033[0;m=cache factory not found: factory for cache adapter "" was not registered
Environment description
Local gitlab-runner
with the following config:
config.toml contents
concurrent = 1
check_interval = 3
[session_server]
session_timeout = 1800
[[runners]]
name = "$HOSTNAME"
url = "https://gitlab.com/"
token = "<hidden>"
executor = "shell"
builds_dir = "/home/gitlab-runner/builds"
cache_dir = "/home/gitlab-runner/cache"
pre_build_script = '<hidden>'
[runners.custom_build_dir]
enabled = true
[runners.cache]
Used GitLab Runner version
Version: 12.0.1
Git revision: 0e5417a3
Git branch:
GO version: go1.8.7
Built: 2019-06-26T15:02:39+0000
OS/Arch: linux/amd64
Possible fixes
Allow explicitly disabling the distributed cache in config.toml
, or don't try to setup the distributed cache when it is not configured.