From cb3bc04c83b97ee45563705cc726b94b1679b002 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 8 Sep 2026 22:16:37 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=83=A8=E7=BD=B2=E8=84=9A=E6=9C=AC=20w?= =?UTF-8?q?orker=20health-cmd=20=E4=B8=AD=20$pid=20=E6=9C=AA=E8=BD=AC?= =?UTF-8?q?=E4=B9=89=E5=AF=BC=E8=87=B4=20staging=20=E9=83=A8=E7=BD=B2?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E5=9B=9E=E6=BB=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ci_staging_deploy.sh 开启 set -eu,worker 容器 --health-cmd 双引号内的 $pid 被外层部署脚本提前展开(pid 未定义)→ 'pid: parameter not set' → worker 容器 docker run 失败 → 判定部署失败并自动回滚。 将 health-cmd 内 $pid 转义为 \$pid,使其透传到容器内由 healthcheck shell 展开(for pid in /proc/[0-9]*/cmdline)。回滚段(195行)与主部署段(504行) 两处一并修复。 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- scripts/ci_staging_deploy.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/ci_staging_deploy.sh b/scripts/ci_staging_deploy.sh index 19e2d7386..f66e70873 100755 --- a/scripts/ci_staging_deploy.sh +++ b/scripts/ci_staging_deploy.sh @@ -192,7 +192,7 @@ rollback() { -e PUBLIC_API_BASE_URL=https://staging-api.xiaoxiajianji.com \ -v "$GENERATED_DIR:/app/generated" \ --restart unless-stopped \ - --health-cmd "sh -c \"for pid in /proc/[0-9]*/cmdline; do if grep -ql celery \"$pid\" 2>/dev/null; then exit 0; fi; done; exit 1\"" \ + --health-cmd "sh -c \"for pid in /proc/[0-9]*/cmdline; do if grep -ql celery \"\$pid\" 2>/dev/null; then exit 0; fi; done; exit 1\"" \ --health-interval 30s \ --health-timeout 10s \ --health-retries 3 \ @@ -501,7 +501,7 @@ docker run -d \ -e PUBLIC_API_BASE_URL=https://staging-api.xiaoxiajianji.com \ -v "$GENERATED_DIR:/app/generated" \ --restart unless-stopped \ - --health-cmd "sh -c \"for pid in /proc/[0-9]*/cmdline; do if grep -ql celery \"$pid\" 2>/dev/null; then exit 0; fi; done; exit 1\"" \ + --health-cmd "sh -c \"for pid in /proc/[0-9]*/cmdline; do if grep -ql celery \"\$pid\" 2>/dev/null; then exit 0; fi; done; exit 1\"" \ --health-interval 30s \ --health-timeout 10s \ --health-retries 3 \ -- 2.54.0