Skip to content

Conversation

Ailrun
Copy link
Member

@Ailrun Ailrun commented Jul 31, 2020

AFAIK, CircleCI's cache system treats a restore key as a prefix of a real cache key, not the exact cache key.
If the prefix(restore key) matches with many cache keys, the recent most cache will be restored.
In our setting, we have two different key schemes for saving cache

  1. stack-cache-{{ .Environment.HIE_CACHE }}-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "stack-build.txt" }}
  2. stack-cache-{{ .Environment.HIE_CACHE }}-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "stack-build.txt" }}-{{ checksum "all-cabal.txt" }}

However, 1. is a prefix of 2., so every prefix (restore key) that matches with 1. also matches with 2., and 2. is created later in the CI script so it's the one that will always be restored.

Ref: https://circleci.com/docs/2.0/configuration-reference/#restore_cache
(see the Note: part)

@Ailrun Ailrun requested review from alanz, jneira and lukel97 July 31, 2020 21:28
Copy link
Member

@jneira jneira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

@lukel97 lukel97 merged commit 75d4c62 into haskell:master Jul 31, 2020
@Ailrun Ailrun deleted the fix-ci branch December 17, 2020 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants