Skip to content

Change default cache key to constant

Description

The default cache is $CI_BUILD_NAME/$CI_BUILD_REF_NAME which means that the cache is not shared between branches. While this is "safe", it means that feature branches and tags always start without a cache, which really slows them down, and makes them susceptible to package manager outages and flakiness. Also, the cache isn't shared between stages so a standard build, test, deploy pipeline would re-download modules for each stage. We should change the cache key to a constant so that the cache is shared across builds for a project. The cache is always keyed on project name, so the cache will never be shared between projects.

Proposal

Change default cache:key to `` or a constant string.

Links / references