From 88c71268c9ef79dea781ee48b4de2987c04b928a Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Fri, 7 Aug 2026 20:07:24 +0800 Subject: [PATCH] fix(ci): resolve Staging API Integration Tests 0s failure Root cause: container name conflict. The CI container PID is always 38, so the container name 'staging-api-tests-38' collides with a leftover container from the previous failed run (set -eu exits before docker rm). Fixes: - Add 'docker rm -f' cleanup before 'docker create' in staging-api-tests (matching the existing pattern in staging-e2e) - Remove invalid 'docker cp package-lock.json' from both staging jobs (file doesn't exist at repo root; already included via 'docker cp apps') Fixes #1275 --- .gitea/workflows/ci-pipeline.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/ci-pipeline.yml b/.gitea/workflows/ci-pipeline.yml index f544f473c..fed87534f 100755 --- a/.gitea/workflows/ci-pipeline.yml +++ b/.gitea/workflows/ci-pipeline.yml @@ -1102,7 +1102,6 @@ jobs: git.xiaoxiajianji.com/xiaoxia/base/playwright:v1.45.0-jammy \ sh -lc "npm ci --registry=https://registry.npmmirror.com && npx playwright test --reporter=line --project=chromium e2e/auth.spec.ts e2e/auth-guard.spec.ts e2e/core-upload.spec.ts e2e/core-generation.spec.ts" docker cp apps "$CONTAINER_NAME:/workspace/" - docker cp package-lock.json "$CONTAINER_NAME:/workspace/" 2>/dev/null || true docker start -a "$CONTAINER_NAME" EXIT_CODE=$(docker wait "$CONTAINER_NAME") docker rm "$CONTAINER_NAME" 2>/dev/null || true @@ -1157,6 +1156,8 @@ jobs: # DooD模式下不能用-v挂载(宿主机路径与CI容器路径不一致) # 改用 docker create + docker cp 方式把代码拷进容器 CONTAINER_NAME="staging-api-tests-$$" + # 强制清理可能残留的同名容器(上一次异常退出时未清理) + docker rm -f "$CONTAINER_NAME" 2>/dev/null || true docker create --name "$CONTAINER_NAME" \ -e E2E_BASE_URL=https://staging.xiaoxiajianji.com \ -e E2E_API_BASE=https://staging-api.xiaoxiajianji.com/api/v1 \ @@ -1164,7 +1165,6 @@ jobs: git.xiaoxiajianji.com/xiaoxia/base/playwright:v1.45.0-jammy \ sh -lc 'npm ci --registry=https://registry.npmmirror.com && npx playwright test --reporter=line e2e/test_auth.spec.ts e2e/test_asset.spec.ts e2e/test_project.spec.ts' docker cp apps "$CONTAINER_NAME:/workspace/" - docker cp package-lock.json "$CONTAINER_NAME:/workspace/" 2>/dev/null || true docker start -a "$CONTAINER_NAME" EXIT_CODE=$(docker wait "$CONTAINER_NAME") docker rm "$CONTAINER_NAME" 2>/dev/null || true