node-orb icon indicating copy to clipboard operation
node-orb copied to clipboard

Cache created but ignored by default

Open jprosevear opened this issue 2 years ago • 6 comments

Orb version:

5.1.0

What happened:

Caching is turned on by default but not used by default because npm ci is used for installation

Expected behavior:

npm ci uses the cache that is restored

Additional Information:

jprosevear avatar Dec 11 '23 23:12 jprosevear

I second this issue. From what I have found in this stackoverflow question it seems that npm ci doesn't really benefit from cache and that is by its design. npm install is the command that takes advantage of cache but according to npm's documentation npm ci is the command that should be used in CI/CD environments.

Last month we stopped storing cache in CircleCI and we saw huge savings on our monthly bill in both reduced build minutes and storage costs.

I think caching should be disabled by default when using npm ci and that should be made clear in CircleCI's documentation that npm ci does not take advantage of cache. As the documentation for this orb stands, it gives the appearance that it will automatically handle caching for you and that will save you credits when in reality people using npm as their package manager end up paying more money with caching turned on.

jdcoldsmith avatar Dec 15 '23 20:12 jdcoldsmith

Any update on this? This feels at best like a bug that should be fixed soon and at worst CircleCI intentionally deceiving its clients to make more money.

jdcoldsmith avatar Jan 11 '24 17:01 jdcoldsmith

Thanks for the heads up, the new version https://circleci.com/developer/orbs/orb/circleci/node?version=6.1.0 is now ignoring cache when npm ci is used.

marboledacci avatar Aug 30 '24 20:08 marboledacci

When you say

the new version [...] is now ignoring cache when npm ci is used

does that mean that the orb is no longer trying to create a cache when using npm ci? We know that npm ci ignores any existing cache, but the issue here (beyond the documentation, which I see is now better) was that it was also creating a cache, which used up storage.

I'm just making sure I'm understanding you right.

tannerstern avatar Sep 04 '24 13:09 tannerstern

Yes, when npm ci is used it will ignore the caching functionality. No cache will be created, therefore no storage used.

marboledacci avatar Sep 04 '24 13:09 marboledacci

Awesome, thanks @marboledacci!

tannerstern avatar Sep 04 '24 14:09 tannerstern