My builds often fail due to problems with the npm cache.
See Busting the `node_modules` cache when certain files change?
Am I able to configure netlify to retry any failed build once while clearing the cache first? That would be a great workaround until a better solution is available.
You could use the deploy failed notification and point it to a Netlify Function (as a webhook). Using that Function and Netlify APi inside it, you can trigger another build with
clear_cache: true as the API body which would do what you need.
P.S.: You can try using developer tools to inspect the API call made by our UI to the API to see how it can be done exactly.
This sounds really good.
Is there a way to inspect the changed files for a build such that:
if any files changed under `/patches/*`, clear the cache
then start the build
You can write a shell script or a Node.js script to check for the diff as you see fit and then delete the cache using:
remove method will help).
I’m not sure how robust this would be for your use case, but worth a try.