[CI] Preview Deploy完全失败 - Docker卷挂载+脚本逻辑双重bug #907

Closed
opened 2026-07-26 08:32:10 +08:00 by xiaoxia · 0 comments
Owner

问题描述

Preview Deploy 100%失败,PR预览环境完全不可用。

铁证

CI Run #11450(PR #900)Job #60250 日志:

Cache miss or invalid: running npm ci...
npm error The `npm ci` command can only install with an existing package-lock.json
npm ci failed, cleaning node_modules and retrying...
rm: cannot remove 'node_modules': Device or resource busy

Dependencies installed, cache updated    ← 虚假成功
Running TypeScript check...
npm error npx canceled due to missing packages: ["tsc@2.0.4"]
Running Vite build...
npm error npx canceled due to missing packages: ["vite@8.1.5"]
Build completed successfully               ← 虚假成功
ls: cannot access 'dist/': No such file or directory
exitcode '2': failure

链接:https://git.xiaoxiajianji.com/xiaoxia/xiaoxia-saas/actions/runs/11450/jobs/60250

影响评估

  • 业务体感:中高。前端团队提交PR后无法预览效果
  • 最近6/6次全部失败,成功率0%
  • 不是required check,不阻断合入,但影响开发效率和PR评审质量

根因分析

  1. Docker卷挂载问题(根因):DooD方式构建前端,xiaoxia-npm-cache volume直接挂到/workspace/apps/web/node_modules,导致volume空目录覆盖工作目录
  2. 脚本逻辑bug(加重):npm ci失败后无法删除node_modules(volume挂载),但脚本未正确退出,继续执行输出虚假成功

修复方向

  1. 修改卷挂载策略:不要直接挂到node_modules,而是挂到缓存目录
  2. 修复脚本逻辑:npm ci失败后必须正确退出,不能输出虚假成功
  3. 参考ci-pipeline.yml中Frontend Lint/Unit Tests的成功实现
## 问题描述 Preview Deploy 100%失败,PR预览环境完全不可用。 ## 铁证 CI Run #11450(PR #900)Job #60250 日志: ``` Cache miss or invalid: running npm ci... npm error The `npm ci` command can only install with an existing package-lock.json npm ci failed, cleaning node_modules and retrying... rm: cannot remove 'node_modules': Device or resource busy Dependencies installed, cache updated ← 虚假成功 Running TypeScript check... npm error npx canceled due to missing packages: ["tsc@2.0.4"] Running Vite build... npm error npx canceled due to missing packages: ["vite@8.1.5"] Build completed successfully ← 虚假成功 ls: cannot access 'dist/': No such file or directory exitcode '2': failure ``` 链接:https://git.xiaoxiajianji.com/xiaoxia/xiaoxia-saas/actions/runs/11450/jobs/60250 ## 影响评估 - **业务体感:中高**。前端团队提交PR后无法预览效果 - 最近6/6次全部失败,成功率0% - 不是required check,不阻断合入,但影响开发效率和PR评审质量 ## 根因分析 1. **Docker卷挂载问题**(根因):DooD方式构建前端,`xiaoxia-npm-cache` volume直接挂到`/workspace/apps/web/node_modules`,导致volume空目录覆盖工作目录 2. **脚本逻辑bug**(加重):npm ci失败后无法删除node_modules(volume挂载),但脚本未正确退出,继续执行输出虚假成功 ## 修复方向 1. 修改卷挂载策略:不要直接挂到node_modules,而是挂到缓存目录 2. 修复脚本逻辑:npm ci失败后必须正确退出,不能输出虚假成功 3. 参考ci-pipeline.yml中Frontend Lint/Unit Tests的成功实现
xiaoxia self-assigned this 2026-07-26 08:52:04 +08:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: xiaoxia/xiaoxia-saas#907