Cache circleci 2.0 on a monthly/regular basis

cache

#1

I think there’s value in updating the cache on a rolling basis, to update our various packages (pipenv/npm/etc) e.g. once a month or so.

This combines the best of having most items cached, but not needing to manually refresh the cache to bring the packages up to speed with the latest.


#2

For Mapbox GL Native, we’ve been using this strategy:

run:
    name: Generate cache key
    command: echo "$(date +"%Y-%V")" > .circle-week
restore_cache:
    keys:
      - 'v3/{{ .Environment.CIRCLE_JOB }}/{{ arch }}/{{ .Branch }}/{{ checksum ".circle-week" }}'
      - 'v3/{{ .Environment.CIRCLE_JOB }}/{{ arch }}/master/{{ checksum ".circle-week" }}'

to get unique cache keys per branch/job/week.


#3

This is a nice tip and should be on the official docs!


#4