Cache not used if key contains "/" in 18.2.0
Summary
After upgrading to the latest 18.2.0 release of the gitlab runner, builds started taking a long time. On investigation it appears the cache is not being used and logs like
Restoring cache
cache key "0_libs/common-validation/-ad2ce3cf603c8374f21a90059218d7ffba330f5b-79-protected" must not contain '/' or its URL-encoded equivalent
can be seen.
Steps to reproduce
Configure the cache key like
cache:
key:
files:
- libs/common-validation/pom.xml
Actual behavior
The cache doesn't download and is not used from S3
Expected behavior
The S3 cache should be used as it was previously
Relevant logs and/or screenshots
Restoring cache
cache key "0_libs/common-validation/-ad2ce3cf603c8374f21a90059218d7ffba330f5b-79-protected" must not contain '/' or its URL-encoded equivalent
Used GitLab Runner version
18.2.0
Possible fixes
Probably related to !5719 (merged)
Workaround
Set cache:key:prefix in addition to cache:key:files, which will make GitLab provide the runner with a valid cache key again.
Edited by Darren Eastman