Handle SpacetimeDB migration imports with chunked uploads
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
2026-04-30 15:20:49 +08:00
parent 1ccb8a710d
commit 22f3f963de
9 changed files with 567 additions and 20 deletions

View File

@@ -16,6 +16,7 @@ pipeline {
string(name: 'ROOT_DIR', defaultValue: '', description: 'spacetime CLI root-dir可选优先于 DEPLOY_DIRECTORY')
string(name: 'INPUT_FILE', defaultValue: '', description: '必填,迁移 JSON 文件路径,相对源码根目录或绝对路径')
string(name: 'INCLUDE_TABLES', defaultValue: '', description: '可选,逗号分隔的表名白名单')
string(name: 'CHUNK_SIZE', defaultValue: '524288', description: '迁移 JSON 分片大小,默认 512KiB用于规避 SpacetimeDB HTTP 413')
booleanParam(name: 'DRY_RUN', defaultValue: true, description: '仅校验导入,不写入数据')
booleanParam(name: 'INCREMENTAL', defaultValue: true, description: '增量导入,跳过已存在或冲突的行')
booleanParam(name: 'REPLACE_EXISTING', defaultValue: false, description: '覆盖本次文件内涉及的表,不可与 INCREMENTAL 同时启用')
@@ -80,6 +81,9 @@ pipeline {
if [[ -n "${params.INCLUDE_TABLES}" ]]; then
args+=(--include "${params.INCLUDE_TABLES}")
fi
if [[ -n "${params.CHUNK_SIZE}" ]]; then
args+=(--chunk-size "${params.CHUNK_SIZE}")
fi
if [[ "${params.DRY_RUN}" == "true" ]]; then
args+=(--dry-run)
fi