platanus / potassium

A Rails application generator by Platanus, inspired by Suspenders
MIT License
232 stars 17 forks source link

Use clearable cache in Circle CI builds #381

Closed rjherrera closed 3 years ago

rjherrera commented 3 years ago

We use a cache key like bundle-dependencies-{{ checksum "Gemfile.lock" }} which works fine, but can't be cleared if needed.

The recommended way to do this is by adding a version to the key, obtained from an environment variable. This way, when we need to invalidate/clear the cache, we simply change the env var. The key is:

bundle-dependencies-{{ .Environment.CACHE_VERSION }}-{{ checksum "Gemfile.lock" }}

And the var value could be v1. What do you guys think?