fix: zip based deploys ignore pattern and subdir case #7636
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
Fixes #EX-835
Problem Description
The zip deploy flow was failing for projects without git repositories when using the
--upload-source-zipflag. The failure occurred during zip file creation with the error:Root Cause
The issue was that the zip command was trying to create a file at a path like
/tmp/abc123/workspace-snapshots/source-xxx.zip, but theworkspace-snapshots/subdirectory didn't exist within the temporary directory.The Netlify API provides filenames that include subdirectory paths, but the CLI wasn't creating the necessary directory structure before attempting to write the zip file.
Reproduction Steps
To reproduce this issue:
netlify deploy --upload-source-zip --json --draft --dir . --no-buildExample reproduction:
Solution
Added directory creation before zip file creation in src/utils/deploy/upload-source-zip.ts:
Also improved exclusion patterns from
node_modulestonode_modules*for more complete directory exclusion.For us to review and ship your PR efficiently, please perform the following steps:
passes our tests.
A picture of a cute animal (not mandatory, but encouraged)