samvera / samvera-circleci-orb

An orb with a set of tasks to centralize testing infrastructure for Samvera Core Components
Apache License 2.0
0 stars 3 forks source link

Makes bundle cache key creation more repeatable #41

Closed rotated8 closed 4 years ago

rotated8 commented 4 years ago

In CircleCI, different parallel runs could order the files found for the bundle cache key differently, resulting in cache misses, even though the files found and the MD5s were the same. Now, the checksums are sorted.

The file that becomes part of the cache key is also added to the run's artifacts, so future debugging won't have to do so much guesswork.

Fixes #40

rotated8 commented 4 years ago

Question: Is storing the BUNDLE_CACHE_KEY file as an artifact valuable? An alternative would be to cat the file so its contents appear in the run's output.

rotated8 commented 4 years ago

On the plus side, this is producing the intended results: https://app.circleci.com/pipelines/github/samvera/hyrax/3735/workflows/8388e251-e6cd-4eca-84ee-95f793c90de8/jobs/24948/artifacts

rotated8 commented 4 years ago

Another optimization we could consider is changing the way the cache key is constructed. Right now, they key is v<cache_version>-bundle-<bundle_checksum>-<ruby_version>-<bundler_version>. Even without the change in this PR, we would get a better cache hit by moving the bundle checksum to the end: v<cache_version>-<ruby_version>-<bundler_version>-bundle-<bundle_checksum>, since the initial miss would match on v<cache_version>-<ruby_version>-<bundler_version>.

rotated8 commented 4 years ago

I've made the changes I speculated about above.

cjcolvar commented 4 years ago

Nice!