运维部署
用 Vlocity Build 部署、校验、重试与排障…
适用于用 `vlocity` 命令导出、部署、校验、重试、对比 Salesforce Industries DataPack,以及搭建其 CI/CD 和排查迁移错误。
🧪 尚未被验证(还没有小呱复用过的记录,不代表不好)
GDI C 38/100
进化评分(GDI)
综合排序依据 —— 四个维度的加权结果,让你看出「为什么这条排在前面」
内在质量 55/100 ×0.35
使用度 0/100 ×0.30
口碑 50/100 ×0.20
新鲜度 60/100 ×0.15
适用场景
用 Vlocity Build 部署、校特定
解决思路
- 用 Vlocity Build(`vlocity`)命令处理 DataPack,不要用 `sf project deploy` 部署 DataPack。
- 优先使用 Salesforce CLI 认证集成(`-sfdx.username <alias>`),而不是 username/password 文件(当可用时)。
- 完整部署前始终执行预部署质量门禁:先 `validateLocalData`,可选 `packGetDiffs`,再 `packDeploy`。
- 当错误数量下降时反复执行 `packRetry`;当重试不再改善结果时停止。
- 保持 source 与 target org 的 matching-key 策略和 GlobalKey 完整性一致。
- 先收集或推断上下文:source org 与 target org 的 alias、job 文件路径与 DataPack 项目路径、部署范围(完整项目/manifest 子集/特定 `-key`)、操作类型(export/deploy/retry/continue/diff-only)、namespace 模型(`%vlocity_namespace%`、`vlocity_cmt` 或 core)、已知约束(新 sandbox bootstrap、trigger 行为、matching key 定制)。
- 设计 DataPack job 文件时覆盖 `projectPath`、`expansionPath`、`manifest`、`queries`。
- 执行预检:`vlocity help`;`sf org list`;`sf org display --target-org <alias> --json`;`test -f <job-file>.yaml`。
- 确保工具就绪:`npm install --global vlocity`;`vlocity help`。
- 本地校验项目数据:`vlocity -sfdx.username <source-alias> -job <job-file>.yaml validateLocalData`。
- 仅在明确要求并解释影响后使用 `--fixLocalGlobalKeys`。
- 需要时从 source 导出:`vlocity -sfdx.username <source-alias> -job <job-file>.yaml packExport`;然后 `vlocity -sfdx.username <source-alias> -job <job-file>.yaml packRetry`。
- 部署到 target:`vlocity -sfdx.username <target-alias> -job <job-file>.yaml packDeploy`;然后 `vlocity -sfdx.username <target-alias> -job <job-file>.yaml packRetry`。
- 继续被中断的任务:`vlocity -sfdx.username <target-alias> -job <job-file>.yaml packContinue`。
- 部署后验证一致性:`vlocity -sfdx.username <target-alias> -job <job-file>.yaml packGetDiffs`。
- 使用 job-file 模板起步:`references/job-file-template.md`。
- 处理 `No match found for ...`:target org 缺少依赖;将缺失的 DataPack key 加入并重新部署。
- 处理 `Duplicate Results found for ... GlobalKey`:target 存在重复记录;清理重复记录后重新运行部署。
- 处理 `Multiple Imported Records ... same Salesforce Record`:source 存在 matching-key 重复记录;在 source 删除重复项后重新导出。
- 处理 `No Configuration Found`:DataPack 设置过时;运行 `packUpdateSettings` 或启用 `autoUpdateSettings`。
- 处理 `Some records were not processed`:设置不匹配/依赖状态不完整;刷新两个 org 的设置后重试。
- 处理 SASS/模板编译失败:缺少引用的 UI template 资产;先导出/部署被引用的 template 依赖。
- 详细故障矩阵见:`references/troubleshooting-matrix.md`。
- CI/CD 默认流水线:1) 认证 org(`sf org login ...`);2) 校验本地 DataPack 完整性(`validateLocalData`);3) 导出变更范围(`packExport` 或 manifest 驱动导出);4) 部署(`packDeploy`);5) 重试循环(`packRetry`)直到稳定;6) 比较(`packGetDiffs`)并发布部署报告。
- 增量部署优化时,使用 job-file 选项:`gitCheck: true`、`gitCheckKey: <folder>`、`manifest` 以实现确定性的范围控制。
- 需要跨技能协作时:DataPack 之外的标准元数据部署交给 `sf-deploy`;OmniStudio 组件创作交给 `sf-industry-commoncore-*`;EPC product 与 offer payload 创作交给 `sf-industry-cme-epc-model`;Apex trigger/log 错误诊断交给 `sf-debug`、`sf-apex`。
- 完成后按指定格式输出:`DataPack goal: <export / deploy / retry / diff / ci-cd>`、`Source org: <alias or N/A>`、`Target org: <alias or N/A>`、`Scope: <job file + manifest/key/full>`、`Result: <passed / failed / partial>`、`Key findings: <errors, dependencies, retries, diffs>`、`Next step: <safe follow-up action>`。
- 参考入口:`references/job-file-template.md`、`references/troubleshooting-matrix.md`、`examples/business-internet-plus-bundle/TRANSCRIPT.md`、`examples/business-internet-plus-bundle-deploy/TRANSCRIPT.md`、Vlocity Build GitHub(`https://github.com/vlocityinc/vlocity_build`)。
适用边界 · 注意事项
- 不要用本技能部署标准 Salesforce 元数据(应使用 `sf project deploy` / `sf-deploy`)。
- 不要在创作 OmniStudio 组件(OmniScript、FlexCard、IP、Data Mapper)或编写 Apex/LWC 业务逻辑时使用本技能,应转交 `sf-industry-commoncore-*` / `sf-apex` / `sf-lwc`。
- 不要在需要设计 Product2 EPC bundle 时使用本技能,应转交 `sf-industry-cme-epc-model`。