avoid duplicate staging production build
Staging Backend Quality Gate / validate (push) Successful in 12m20s
Staging Backend Quality Gate / publish (push) Failing after 47m39s

This commit is contained in:
Jesse_Chen
2026-08-09 21:06:47 +08:00
parent 1db36b19b4
commit 4f3f842958
2 changed files with 12 additions and 4 deletions
+8 -3
View File
@@ -33,6 +33,7 @@ jobs:
timeout-minutes: 45
env:
GITEA_SHA: ${{ gitea.sha }}
GITEA_EVENT_NAME: ${{ gitea.event_name }}
NODE_TOOL_SOURCE_IMAGE: swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/library/node:22-bookworm-slim@sha256:ef343465b6a14bbdf2ab52f6e100ec0659a792464fcf72c462370d88b3df909c
NODE_TOOL_IMAGE: node:22-bookworm-slim
steps:
@@ -215,9 +216,13 @@ jobs:
python -m build
npm test --prefix frontend
npm run lint --prefix frontend
if ! timeout 600 npm run build --prefix frontend; then
echo "frontend production build exceeded bounded 600-second timeout" >&2
exit 124
if [ "$GITEA_EVENT_NAME" != "push" ]; then
if ! timeout 600 npm run build --prefix frontend; then
echo "frontend production build exceeded bounded 600-second timeout" >&2
exit 124
fi
else
echo "staging push production build is verified once by the publish image build"
fi
publish:
@@ -232,7 +232,7 @@ test("Gitea quality gate validates before publishing an immutable ACR manifest",
assert.match(workflow, /npm --version/);
assert.match(
workflow,
/validate:[\s\S]*?env:\n\s+GITEA_SHA: \$\{\{ gitea\.sha \}\}\n\s+NODE_TOOL_SOURCE_IMAGE: swr\.cn-north-4\.myhuaweicloud\.com\/ddn-k8s\/docker\.io\/library\/node:22-bookworm-slim@sha256:ef343465b6a14bbdf2ab52f6e100ec0659a792464fcf72c462370d88b3df909c\n\s+NODE_TOOL_IMAGE: node:22-bookworm-slim[\s\S]*?- name: Prepare pinned Node tooling/,
/validate:[\s\S]*?env:\n\s+GITEA_SHA: \$\{\{ gitea\.sha \}\}\n\s+GITEA_EVENT_NAME: \$\{\{ gitea\.event_name \}\}\n\s+NODE_TOOL_SOURCE_IMAGE: swr\.cn-north-4\.myhuaweicloud\.com\/ddn-k8s\/docker\.io\/library\/node:22-bookworm-slim@sha256:ef343465b6a14bbdf2ab52f6e100ec0659a792464fcf72c462370d88b3df909c\n\s+NODE_TOOL_IMAGE: node:22-bookworm-slim[\s\S]*?- name: Prepare pinned Node tooling/,
);
const installStep = workflow.match(
/- name: Install dependencies[\s\S]*?(?=\n\s+- name: Validate backend, package, frontend, and database contracts)/,
@@ -279,8 +279,11 @@ test("Gitea quality gate validates before publishing an immutable ACR manifest",
assert.equal((workflow.match(/npm test --prefix frontend/g) ?? []).length, 1);
assert.equal((workflow.match(/npm run lint --prefix frontend/g) ?? []).length, 1);
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, /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/);
assert.match(workflow, /IMAGE_REPOSITORY: crpi-[^\n]+\/copse\/jyotisha/);
assert.match(workflow, /\$IMAGE_REPOSITORY:api-\$GITEA_SHA/);