CircleCI-Public / node-orb

An orb for working with Node.js on CircleCI
https://circleci.com/orbs/registry/orb/circleci/node
MIT License
52 stars 80 forks source link

Cache created but ignored by default #202

Open jprosevear opened 9 months ago

jprosevear commented 9 months ago

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:

jdcoldsmith commented 8 months ago

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 commented 7 months ago

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.

marboledacci commented 1 week ago

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.

tannerstern commented 2 days ago

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.

marboledacci commented 2 days ago

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

tannerstern commented 2 days ago

Awesome, thanks @marboledacci!