feat: add ability to provide existing file digest #5589
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Simulates On-Demand ISR by adding the ability to provide an existing file digest, without requiring those files to actually exist or be hashed (#297).
Rationale
Currently On-Demand ISR is not supported on the Next.js Runtime. We can emulate this capability with external CI and the Netlify CLI by simply redoing the deploy with the changed files, plus all the previous deploys' files. The Netlify CLI hashes all these files, and the Netlify API will reply that only the changed files need to be uploaded.
If there are a lot of these files, we ask our CI to restore and then Netlify CLI to hash files that we know we have no intention of uploading.
Instead, the CI could just cache only the previous deploys' file digest JSON (or re-request it using the undocumented API
/api/v1/deploys/{deploy_id}/files
), and enable the CLI deploy command to merge the digest of just the new files, with the previous digest.This is a WIP and more of a PoC of a strategy that could enable performant incremental uploads with an external build system, which is likely not the direction Netlify hopes to pursue.
Demo
base-deploy
directory containing onlyone.html
to a Netlify siteone
exists:new-deploy
directory containing onlytwo.html
, but pass the existing file digest JSONtwo
existsone
also still existsFor us to review and ship your PR efficiently, please perform the following steps:
passes our tests.