Skip to content

Commit 80e63fc

Browse files
authored
feat(cli): import site archives larger than the instance size limit via --split (#484)
Add multi-part site archive import to b2c job import. --split (with optional --max-size, default 190mb) breaks a large directory import into smaller archives imported sequentially: order-sensitive metadata/XML first (kept together, or split at data-unit boundaries in dependency order), then static assets packed by compressed size. Non-split imports that exceed the limit warn and recommend --split. SDK adds siteArchiveImportSplit(). W-22899416
1 parent 37269fc commit 80e63fc

8 files changed

Lines changed: 1240 additions & 55 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
'@salesforce/b2c-cli': minor
3+
'@salesforce/b2c-tooling-sdk': minor
4+
'@salesforce/b2c-agent-plugins': patch
5+
---
6+
7+
`b2c job import` now supports `--split` for importing directories larger than the instance archive size limit. With `--split` (and optional `--max-size`, default `190mb`), the import is broken into several smaller archives: order-sensitive metadata/XML is imported first — kept together when it fits, otherwise split at data-unit boundaries in dependency order — followed by static assets packed by compressed size. A normal import that exceeds the limit now warns and recommends `--split`.
8+
9+
Example: `b2c job import ./big-site-data --split --max-size 150mb`
10+
11+
The SDK adds a corresponding `siteArchiveImportSplit()` operation.

docs/cli/jobs.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,8 @@ In addition to [global flags](./index#global-flags):
280280
|------|-------------|---------|
281281
| `--keep-archive`, `-k` | Keep archive on instance after import | `false` |
282282
| `--remote`, `-r` | Target is a filename already on the instance (in Impex/src/instance/) | `false` |
283+
| `--split`, `-s` | Split a large directory import into multiple archive parts to stay under the instance size limit | `false` |
284+
| `--max-size` | Per-archive size limit for `--split` (e.g. `190`, `190mb`, `512kb`; a bare number is MiB) | `190mb` |
283285
| `--timeout`, `-t` | Timeout in seconds | No timeout |
284286
| `--wait`, `-w` | Wait for import job to complete | `true` |
285287
| `--show-log` | Show job log on failure | `true` |
@@ -310,6 +312,12 @@ b2c job import ./my-site-data 'libraries/**'
310312

311313
# Mix sites and libraries
312314
b2c job import ./my-site-data sites/RefArch 'libraries/*'
315+
316+
# Split a large import that exceeds the instance archive size limit
317+
b2c job import ./big-site-data --split
318+
319+
# Split with a custom per-archive size limit
320+
b2c job import ./big-site-data --split --max-size 150mb
313321
```
314322

315323
### Notes
@@ -319,6 +327,21 @@ b2c job import ./my-site-data sites/RefArch 'libraries/*'
319327
- By default, the archive is deleted after successful import (use `--keep-archive` to retain)
320328
- When `PATHS` are given, only those files/directories are included in the archive — their location under `TARGET` is preserved (e.g. `sites/RefArch/...` stays at `sites/RefArch/...`).
321329

330+
### Importing archives larger than the instance limit
331+
332+
A B2C Commerce instance rejects a single import archive above its size limit (typically 200 MB). The `--split` flag works around this **for directory imports** by importing the data in multiple smaller archive parts:
333+
334+
1. **Metadata/XML first.** All order-sensitive XML (catalogs, libraries, sites, `meta`, etc.) is imported first, kept together in a single archive when it fits. Keeping it together means the import job resolves all internal references and dependency ordering within one archive. If the XML alone exceeds the limit, it is split at top-level data-unit boundaries (e.g. `catalogs`, `libraries`, `sites`) in dependency order — never splitting an individual unit, so a catalog and its internal references always stay together.
335+
2. **Static assets after.** Static resources (anything under a `static/` folder — images, fonts, binaries) are deferred into subsequent archive parts, packed by **compressed** size. They are order-independent and attach to the catalogs/libraries created by the metadata import.
336+
337+
Parts are imported **sequentially** and the command stops on the first failure.
338+
339+
Packing is by estimated compressed size (already-compressed file types such as JPG/PNG/ZIP are measured as stored). The default per-part ceiling is `190mb` to leave headroom under the instance limit; tune it with `--max-size`.
340+
341+
If a **single file** or a **single data unit's XML** is larger than `--max-size` on its own, it cannot be placed in any part (a file is never split across archives) and the command errors — reduce the export scope for that unit or raise `--max-size` if the instance allows a larger archive.
342+
343+
When you run a normal (non-`--split`) directory import and the assembled archive exceeds the limit, the command warns and recommends re-running with `--split`. `--split` cannot be combined with `--remote`, subset `PATHS`, or `--no-wait`.
344+
322345
---
323346

324347
## b2c job export

0 commit comments

Comments
 (0)