Cache circleci 2.0 on a monthly/regular basis



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.


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

    name: Generate cache key
    command: echo "$(date +"%Y-%V")" > .circle-week
      - '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.


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