Skip to content

Add backup exclude options and defaults - #436

Closed
whoiskatrin wants to merge 1 commit into
cloudflare:mainfrom
whoiskatrin:ignore-files-backup
Closed

whoiskatrin wants to merge 1 commit into
cloudflare:mainfrom
whoiskatrin:ignore-files-backup

Conversation

@whoiskatrin

@whoiskatrin whoiskatrin commented Mar 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This PR adds end-to-end support for excluding files from backup archives.

createBackup() now supports:

  • exclude: string[] for custom mksquashfs exclude patterns
  • excludeDefaults: boolean to include a default ignore set

Default excludes are:
node_modules, .git, dist, build, .next, .turbo, .cache

Why

Backups currently include dependency and build directories by default,
which can make archives much larger than needed and slow down backup and
restore workflows.

API and behavior

BackupOptions.exclude is now wired through SDK -> DO -> container backup
service. Patterns are passed to mksquashfs -ef (one pattern per line).

excludeDefaults defaults to false for backward-compatible behavior.
Validation was added for exclude and excludeDefaults inputs.

Tests

Added two backup workflow E2E tests:

  • restore excludes paths passed in exclude
  • restore excludes default paths when excludeDefaults: true

Also ran local type checks through the pre-push hook.

Reviewer notes

This is intentionally minimal and keeps the existing backup flow. The
only functional flow change is passing an optional exclude file to
mksquashfs.

This adds end-to-end support for backup exclude patterns so users can
skip dependency and build directories during createBackup. It also adds
an excludeDefaults option for common paths and covers both exclude and
default excludes with backup workflow E2E tests.
@changeset-bot

changeset-bot Bot commented Mar 2, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 313c92e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@cloudflare/sandbox Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@whoiskatrin

Copy link
Copy Markdown
Contributor Author

Closing in favor of #437, which uses branch in this repository (no fork).

@whoiskatrin whoiskatrin closed this Mar 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant