Fine-grained Control Over Caching for Deployment Targets in NX #28331
Replies: 1 comment
-
I'm fully aware that NX's normal use case is usually for Continuous Integration only (builds, linting, testing, etc.). However, NX fully utilizes its capabilities if also used for deployments - due to the NX replay functionality (which makes total sense for having all logs/reports in one place), one needs to make these normally non-cacheable targets sadlly also cacheable as well and with that replayable for the main runner in nx cloud. I'm pretty sure a more ideal solution would be something where there is no real caching from the user side required, and where this is entirely handled by NX itself. Ideally, one wouldn't even need to define any kind of caching for deployment-related targets (e.g., CloudFormation deployments, pushing docker images, etc.), but could simply enable some kind of option like:
Because that's basically how it would be normally expected - no caches, yet runnable via DTE on NX cloud. The only reason we define caches at all in targets like that, is simply to make them replayable and runnable with DTE enabled. |
Beta Was this translation helpful? Give feedback.
-
Description
We currently use NX with NX Cloud and DTE (Deployment Task Execution) for our CI/CD pipeline. To ensure that deployment-related targets are not cached between pipeline runs, we use dynamic inputs for these targets. This approach works well for NX Cloud and DTE, but presents challenges when trying to execute locally.
Key points:
Current Behavior
CI/CD Pipeline:
Local Execution:
Proposed Solution
Implement a configuration option for deployment targets that allows them to be executed locally without being affected by cached inputs. Specifically:
Add a new option to target configurations:
"cache_if_ci": true
When set to true:
When set to false:
When both cache and cache_if_ci set to true:
Example Configuration
Benefits
Technical Considerations
Why Current Approach is Suboptimal
Using
--skip-nx-cache
for deployment targets is not ideal because:Next Steps
Please review this proposal and let us know if you need any clarification or have suggestions for implementation.
Beta Was this translation helpful? Give feedback.
All reactions