fix(ci): add npm retry logic for staging tests #1279
Reference in New Issue
Block a user
Delete Branch "fix/staging-tests-npm-retry"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
问题
Staging E2E Tests 和 Staging API Integration Tests 在 npm ci 阶段因 npmmirror registry 返回 504 Gateway Time-out 而失败。
失败示例(Run #24802, job 110803):
修复
为 npm ci 添加重试机制:
修改内容
.gitea/workflows/ci-pipeline.yml:npm ci && npx playwright test ...改为for i in 1 2 3; do npm ci && break; echo "retry..."; sleep 15; done && npx playwright test ...影响
Fixes #1274
🚀 预览环境已部署
🗑️ 预览环境已清理
PR #1279 已关闭或合并,对应的预览环境已被清理。
代码审查结果 - PR #1279
⚠️ 问题(1个需要修改)
for循环的退出状态逻辑错误,导致npm ci失败后仍会继续执行测试。for循环的退出状态取决于循环体内最后执行的那条命令。如果npm ci在 3 次重试中均失败,循环体内最后执行的命令是sleep 15(退出码为 0),导致整个循环返回成功状态。&& npx playwright test ...仍会被触发,导致测试在环境不完整的情况下运行,产生误导性的报错或不可预期的结果,掩盖了真正的构建失败原因。💡 建议(0个可选)
无
❌ 格式检查通过 | ❌ 逻辑审查需修改 | ✅ 建议关注性能
🤖 由 AI 代码审查机器人自动生成 | 2026-08-07 12:23:50 | 模型: