From 3849548087c1a48eb1cc533037270b4630f1557c Mon Sep 17 00:00:00 2001 From: ximenchuifeng Date: Sat, 22 Aug 2026 13:41:05 +0800 Subject: [PATCH] =?UTF-8?q?fix(promote):=20CUSTOMER=20=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E9=98=B2=E5=91=86=E2=80=94=E2=80=94=E5=94=AF=E4=B8=80=E5=AE=A2?= =?UTF-8?q?=E6=88=B7=E7=9B=AE=E5=BD=95=E6=89=8D=E5=85=81=E8=AE=B8=E7=BC=BA?= =?UTF-8?q?=E7=9C=81,=E5=A4=9A=E5=AE=A2=E6=88=B7=E6=97=B6=E5=BF=85?= =?UTF-8?q?=E9=A1=BB=E6=98=BE=E5=BC=8F=E6=8C=87=E5=AE=9A(=E9=98=B2?= =?UTF-8?q?=E5=8F=91=E9=94=99=E7=8E=B0=E5=9C=BA)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ci/promote.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/ci/promote.sh b/ci/promote.sh index 9551450..51dabe0 100755 --- a/ci/promote.sh +++ b/ci/promote.sh @@ -47,7 +47,20 @@ require_env() { # prepare # ───────────────────────────────────────────── do_prepare() { - CUSTOMER="${CUSTOMER:-mxlexus}" + # 客户解析:唯一客户目录时可省略 CUSTOMER;多客户时不填即拒绝(防发错现场) + CUSTOMERS=$(ls -1 "$WS/environments" 2>/dev/null | grep -vE '^(_common|demo|dev)$' || true) + C_COUNT=$(printf '%s\n' "$CUSTOMERS" | grep -c . || true) + if [ -z "${CUSTOMER:-}" ]; then + if [ "$C_COUNT" = "1" ]; then + CUSTOMER="$CUSTOMERS" + log "未指定 CUSTOMER,唯一客户目录: $CUSTOMER" + else + die "检测到 ${C_COUNT} 个客户目录,不填 CUSTOMER 无法确定发给谁。现有客户: $(printf '%s ' $CUSTOMERS)" + fi + fi + [ -d "$WS/environments/$CUSTOMER" ] \ + || die "environments/$CUSTOMER 不存在。现有客户: $(printf '%s ' $CUSTOMERS)" + RELEASE_VERSION="${RELEASE_VERSION:-$(sh ci/auto-bump.sh)}" case "$RELEASE_VERSION" in v[0-9]*.[0-9]*.[0-9]*) : ;;