Skip to content

feat: add avocado save/load for portable build state archives#124

Merged
mobileoverlord merged 2 commits intomainfrom
jschneck/save
Apr 2, 2026
Merged

feat: add avocado save/load for portable build state archives#124
mobileoverlord merged 2 commits intomainfrom
jschneck/save

Conversation

@mobileoverlord
Copy link
Copy Markdown
Contributor

@mobileoverlord mobileoverlord commented Apr 2, 2026

Summary

  • Add avocado save and avocado load commands that snapshot the entire Docker volume (SDK, extensions, runtimes, output artifacts, stamps) plus project config to a compressed .tar.gz archive
  • avocado save -o state.tar.gz exports volume + config; --include-src optionally packs the src_dir
  • avocado load -i state.tar.gz restores everything so avocado provision works on a new machine without re-running install/build
  • Uses gzp for multi-threaded gzip compression across all CPU cores
  • Progress bars via indicatif for both save (with du -sb for total size) and load (file-size based)
  • Auto-register QEMU binfmt handler for cross-arch SDK emulation when --sdk-arch is used on Linux

Test plan

  • avocado save -o state.tar.gz produces a valid archive after install + build
  • avocado save --include-src -o state.tar.gz includes source directory contents
  • avocado load -i state.tar.gz in a clean directory restores config + volume
  • avocado provision works after load without needing install/build
  • avocado load with existing .avocado-state errors without --force
  • avocado load --force overwrites existing state
  • Progress bars display during save and load operations
  • Archives with hardlinks (e.g. terminfo) extract correctly
  • tar tzf state.tar.gz shows expected avocado-state/ layout

Add save and load commands that snapshot the entire Docker volume
(SDK, extensions, runtimes, output artifacts, stamps) plus project
config to a compressed tar.gz archive. This allows transferring
build state between machines so that `avocado load` + `avocado provision`
works without re-running install/build.

- `avocado save -o state.tar.gz` exports volume + config
- `avocado save -o state.tar.gz --include-src` also packs src_dir
- `avocado load -i state.tar.gz` restores volume, config, and src
When --sdk-arch targets a different architecture than the host,
Docker needs QEMU binfmt_misc to run the foreign-arch container.
Docker Desktop has this built-in, but Linux Docker Engine does not.

This detects the missing handler and auto-registers it via
tonistiigi/binfmt, with a clear error message if registration fails.
@mobileoverlord mobileoverlord merged commit 1eb294d into main Apr 2, 2026
5 checks passed
@mobileoverlord mobileoverlord deleted the jschneck/save branch April 2, 2026 20:02
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