Cache successfully saved and restored, but file not updated on testing environment

Hello,

I’ve spent a few hours reading about CircleCI’s caching and how to use save_cache and restore_cache; I believed I had gotten a good understanding of how they work but I still seem to be having problems.

My project is foo; there is a file at foo/bar/node_modules/baz/build/static/js/stuff.js. I want CircleCI to clear the cache and get an updated version of stuff.js every single time that file changes. Normally this can be done with versioning, but baz/ is actually another app inside of foo/ that doesn’t use versioning. It is linked in foo/bar/package.json like so:

"baz": "file:./../baz"

So after reading about how CircleCI caching works, I added the following “steps” to my job in config.yml:

- restore_cache:
keys: dependency-cache-{{ checksum "bar/node_modules/baz/build/static/js/stuff.js" }}-v1
...
- save_cache:
keys: dependency-cache-{{ checksum "bar/node_modules/baz/build/static/js/stuff.js" }}-v1
when: always
paths: - "bar/node_modules"

After checking the results of my successfully completed jobs, it seems that it is successfully creating the cache as well as restoring it. However, when I look at my deployed code, bar/node_modules/baz/build/static/js/stuff.js still seems to be retrieving an older copy. Is there something I’m doing wrong with the setup of caches in config.yml?

Any help would be greatly appreciated.

Thanks,

-DR

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.