keep staging image build on turbopack
Staging Backend Quality Gate / validate (push) Successful in 17m58s
Staging Backend Quality Gate / publish (push) Successful in 4m14s

This commit is contained in:
Jesse_Chen
2026-08-09 22:14:40 +08:00
parent 4f3f842958
commit 9235ee66f6
4 changed files with 20 additions and 4 deletions
+1 -1
View File
@@ -217,7 +217,7 @@ jobs:
npm test --prefix frontend
npm run lint --prefix frontend
if [ "$GITEA_EVENT_NAME" != "push" ]; then
if ! timeout 600 npm run build --prefix frontend; then
if ! timeout 600 npm run build --prefix frontend -- --webpack; then
echo "frontend production build exceeded bounded 600-second timeout" >&2
exit 124
fi
+16
View File
@@ -2552,3 +2552,19 @@
- 相关记录:BUG-129、BUG-136、BUG-142
- 复发自:无
- 修复版本:待本次提交 / gate / deploy
## BUG-150 | staging publish 的 Webpack 镜像构建耗尽共享 Gitea 资源
- 状态:resolvedlocal candidate,远端 gate/deploy 待本提交)
- 首次发现:2026-08-09
- 最近更新:2026-08-09
- 影响面:Gitea staging quality gate 的 publish 镜像构建、共享 Gitea/runner 可用性;production 未涉及。
- 用户现象:Run 1634 的 validate 在约 12 分钟内成功,publish 随后在 Docker 内执行 `next build --webpack` 超过 25 分钟;期间 Gitea API 持续返回 502 和空 JSON,最终 job 中断。
- 触发条件:`frontend/package.json` 将默认 `build` 改为 Webpack 后,Dockerfile 的 `RUN npm run build` 也继承该构建器;classic Docker builder 的慢 COPY 与资源受限 runner 进一步放大构建开销。
- 根因:为非 push 校验引入的 Webpack 兼容参数错误地放进了全局 package script,使实际镜像发布也从已成功的 Turbopack 路径切换到高开销 WebpackGitea 与 runner 共享资源时因此拖垮控制面。直接重跑旧 revision 会重复相同故障。
- 修复:恢复默认 `npm run build``next build`,让 Docker publish 继续使用 Turbopack;仅在 PR/manual 的非 push validate 分支显式追加 `-- --webpack`。staging push 继续跳过重复 production build,由 publish 镜像构建唯一验证。
- 验证:聚焦 workflow contract 锁定默认 Turbopack、非 push Webpack 与 staging push 单次镜像构建语义;本地测试和 `git diff --check` 通过。远端 gate、publish、deploy 与 exact-SHA smoke 待本提交后验证。
- 防复发:不得把只用于隔离 worktree/非 push 校验的构建器参数写回全局 package script;发布构建器变化必须由 workflow contract 同时覆盖 Dockerfile 与事件分支。
- 相关记录:BUG-142、BUG-149
- 复发自:无
- 修复版本:待本次提交 / gate / deploy
+1 -1
View File
@@ -5,7 +5,7 @@
"type": "module",
"scripts": {
"dev": "next dev",
"build": "next build --webpack",
"build": "next build",
"start": "next start",
"test": "tsx --test tests/*.test.ts",
"test:db": "tsx --test --test-concurrency=1 tests/database-*.test.ts",
@@ -132,7 +132,7 @@ test("railway web image uses Next standalone runtime output", () => {
const config = read(nextConfig);
const packageJson = JSON.parse(read(frontendPackage)) as { scripts?: { build?: string } };
assert.equal(packageJson.scripts?.build, "next build --webpack");
assert.equal(packageJson.scripts?.build, "next build");
assert.match(config, /output: "standalone"/);
assert.match(config, /outputFileTracingRoot: repositoryRoot/);
assert.match(dockerfile, /RUN npm run build\n/);
@@ -281,7 +281,7 @@ test("Gitea quality gate validates before publishing an immutable ACR manifest",
assert.equal((workflow.match(/npm run build --prefix frontend/g) ?? []).length, 1);
assert.match(workflow, /GITEA_EVENT_NAME: \$\{\{ gitea\.event_name \}\}/);
assert.match(workflow, /if \[ "\$GITEA_EVENT_NAME" != "push" \]; then/);
assert.match(workflow, /timeout 600 npm run build --prefix frontend/);
assert.match(workflow, /timeout 600 npm run build --prefix frontend -- --webpack/);
assert.match(workflow, /frontend production build exceeded bounded 600-second timeout/);
assert.match(workflow, /staging push production build is verified once by the publish image build/);
assert.match(workflow, /needs: validate/);