From 9bcfec890bab8474bb81ce420e2696fc4e5a39bd Mon Sep 17 00:00:00 2001 From: wangbo Date: Tue, 4 Aug 2026 18:44:19 +0800 Subject: [PATCH] =?UTF-8?q?fix(release):=20=E9=BB=98=E8=AE=A4=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=20Kubernetes=20=E7=94=9F=E4=BA=A7=E9=80=9A=E9=81=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 原因:旧 Compose 生产环境已退役,默认通道仍指向 Compose 会在每次发布时先命中无效数据库。\n\n影响:发布和部署脚本默认读取 Kubernetes release helper;仍可通过显式 AI_GATEWAY_DEPLOY_MODE=compose 操作遗留环境。\n\n验证:bash -n、ShellCheck 和 manual-release-test 全部通过。 --- scripts/deploy-production-release.sh | 5 ++++- scripts/publish-release-images.sh | 3 ++- tests/release/manual-release-test.sh | 9 +++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/scripts/deploy-production-release.sh b/scripts/deploy-production-release.sh index 22c42b4..1643bd5 100755 --- a/scripts/deploy-production-release.sh +++ b/scripts/deploy-production-release.sh @@ -3,7 +3,7 @@ set -euo pipefail root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd) production_host=${AI_GATEWAY_PRODUCTION_HOST:-root@110.42.51.33} -deploy_mode=${AI_GATEWAY_DEPLOY_MODE:-compose} +deploy_mode=${AI_GATEWAY_DEPLOY_MODE:-kubernetes} case $deploy_mode in compose) default_remote_helper=/usr/local/sbin/easyai-ai-gateway-release ;; kubernetes) default_remote_helper=/usr/local/sbin/easyai-ai-gateway-cluster-release ;; @@ -23,6 +23,9 @@ Usage: This command changes production. Run it only after a successful publish command and an explicit user request to release or deploy to production. + +AI_GATEWAY_DEPLOY_MODE defaults to kubernetes. Set it to compose only for an +explicit legacy-environment operation. EOF } diff --git a/scripts/publish-release-images.sh b/scripts/publish-release-images.sh index f7955ca..db265b3 100755 --- a/scripts/publish-release-images.sh +++ b/scripts/publish-release-images.sh @@ -6,7 +6,7 @@ cd "$root" components=auto production_host=${AI_GATEWAY_PRODUCTION_HOST:-root@110.42.51.33} -deploy_mode=${AI_GATEWAY_DEPLOY_MODE:-compose} +deploy_mode=${AI_GATEWAY_DEPLOY_MODE:-kubernetes} case $deploy_mode in compose) default_remote_helper=/usr/local/sbin/easyai-ai-gateway-release ;; kubernetes) default_remote_helper=/usr/local/sbin/easyai-ai-gateway-cluster-release ;; @@ -29,6 +29,7 @@ changes production. When the user requested a production release, continue with scripts/deploy-production-release.sh without requesting confirmation again. Environment: + AI_GATEWAY_DEPLOY_MODE Production target (default: kubernetes) AI_GATEWAY_PRODUCTION_HOST SSH target used for read-only release status AI_GATEWAY_REMOTE_RELEASE_HELPER Fixed status/deploy helper on the server AI_GATEWAY_IMAGE_REGISTRY Registry namespace diff --git a/tests/release/manual-release-test.sh b/tests/release/manual-release-test.sh index d0cf7ec..829da40 100755 --- a/tests/release/manual-release-test.sh +++ b/tests/release/manual-release-test.sh @@ -5,6 +5,15 @@ root=$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd) tmp=$(mktemp -d) trap 'rm -rf "$tmp"' EXIT +for release_script in \ + "$root/scripts/publish-release-images.sh" \ + "$root/scripts/deploy-production-release.sh"; do + grep -F "deploy_mode=\${AI_GATEWAY_DEPLOY_MODE:-kubernetes}" "$release_script" >/dev/null || { + echo "production release script does not default to Kubernetes: $release_script" >&2 + exit 1 + } +done + new_repo() { local name=$1 local repo=$tmp/$name