nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.75k stars 2.37k forks source link

Expected remote cache functionality #28936

Open arvidboivie opened 1 week ago

arvidboivie commented 1 week ago

Documentation issue

Is there a specific documentation page you are reporting?

https://nx.dev/nx-enterprise/powerpack/custom-caching (Or somewhere adjacent)

Additional context or description

When implementing the Powerpack S3 Remote cache, I came across this post which makes me wonder about the intended functionality of the remote cache. Is it supposed to work only in CI environments?

From early testing it seems that it neither pushes to or pulls from the remote cache when running tasks locally, which is not what I would have expected. There are no info or error messages displayed regarding caching (local cache still works as expected). There's also no information in the docs that I've been able to find regarding this.

Note: Caching works in our CI environment, so this doesn't seem to be a configuration issue?

Expected behaviour:

Remote cache will read/write regardless if task is run on developer machine or in CI environment. If this isn't the intended behaviour, I would argue that the documentation needs to make it clear that that is the case.

giltayar commented 1 day ago

I found that out too!

The hack is to set environment variable CI=1, and then it works locally. I wish it was a configuration in nx.json.

arvidboivie commented 5 hours ago

Thanks for the info!

I agree that having this as an option (or the default functionality) would be great. I guess you could set up a .env file with CI=true that Nx would read (like this).

But there's probably more tools looking for the CI variable, so it might have other unintended effects as well when turning it on locally.