Clear Cache and Retry for Deploy Preview Does not Update Pull Request

Hey @bennypowers :wave:

We must clear the cache before each build because netlify’s node build process does not respect the package-lock.json, and the cache’s node_modules is out of date, causing build errors. This is itself an ongoing problem for us, and is documented in several places in this forum, for example https://answers.netlify.com/t/how-to-enforce-package-lock-json/39735

We’ve recently deployed a change behind a feature flag which removes our “skip” logic for npm install, making sure we always run it and leaving it up to the tool to work with the given lockfile and node_modules and decide what needs to be installed - chore: run pre & post install scripts by jobala · Pull Request #854 · netlify/build-image · GitHub. While this is still being rolled out (it isn’t at 100% yet) we can enable it for your account if you want (we’ll need some account info, like site/account name so that we can target your account).

If I understood your problem correctly I think that will likely fix it for you.

Prior to a month or two ago, retrying a failed deploy preview build would notify the PR branch. Now, if the retry passes, the PR status check continues to point to the old fashioned build, and the PR will remain blocked until an (unnecessary) commit is pushed. This adds unnecessary friction to our already overloaded review cycle.

We’ve recently fixed a bug in our system where we were performing misleading retries for builds. We lead customers to believe we were retrying builds for a particular commit when in reality we always build from HEAD. We’ve removed the misleading behaviour by making it clear we always build from HEAD when retrying builds. This however had the unintended consequence of breaking the behaviour for PR status checks for deploy previews. Since builds use the ref HEAD they no longer update the correct commit ref for the PR. This has been identified and we already have planned work to fix this (unfortunately we can’t really commit to a timeline since there’s a couple of moving pieces and we want to make sure we don’t cause further unintended breaking behaviour), but tl;dr we’re aware and we want to fix it :+1:

Sorry you’re having trouble with builds but hope this helps. Let us know if you need anything else and also if you want us to roll that feature flag for you. Thank you!