CircleCI 2.0 cache key not found on subsequent builds

caching
cache
2.0
cci-20

#1

Currently my build jobs are taking 3x longer than they should as even though the cache key doesn’t change (it is a hash of a concatenation of various dependency files (requirements.txt, yarn.lock etc.), with a static prefix and the {{arch}}), and the cache is saved at the end of each successful job, subsequent builds fail to find the exact same key.

For example:

No cache is found for key: dependency-cache-arch1-linux-amd64-6_62-NAMB-571-update-to-cicrcle-ci-2-qYjV0bO4jXbcKdvVJxy7JEk_FYAp1Pw9bJKQ3aK5pck=
No cache is found for key: dependency-cache-arch1-linux-amd64-6_62-master
Creating cache archive...
Uploading cache archive...
Stored Cache to dependency-cache-arch1-linux-amd64-6_62-NAMB-571-update-to-cicrcle-ci-2-qYjV0bO4jXbcKdvVJxy7JEk_FYAp1Pw9bJKQ3aK5pck=

<paths>
No cache is found for key: dependency-cache-arch1-linux-amd64-6_62-NAMB-571-update-to-cicrcle-ci-2-WBP28nFJ+ixWKMoYjs54H6UodJsqom19315+jBx07Ms=
No cache is found for key: dependency-cache-arch1-linux-amd64-6_62-master

etc.


#2

Heh, on re-reading my own post I notice the cache key changed on that subsequent build…but the files that are used for the hash didn’t change, whaaaaat?!


#3

PEBKAC.

I was using a find .. -exec invocation to build the cache key that wasn’t guaranteed to be the same between checkouts, doh.


#4