fix(release): validate remote business response codes

This commit is contained in:
2026-07-14 15:25:16 +08:00
parent 6ed0521a50
commit 7629a1b80e
3 changed files with 15 additions and 5 deletions
+12 -5
View File
@@ -72,6 +72,17 @@ require_fresh_artifact "$mobile_index"
require_fresh_artifact "$mobile_asset_path"
require_fresh_artifact "$backend_jar"
require_remote_business_success() {
local label="$1"
local url="$2"
local body
body="$(curl -fsS --max-time 15 "$url")" || fail "$label HTTP check failed: $url"
if ! printf '%s' "$body" | LC_ALL=C grep -Eq '"code"[[:space:]]*:[[:space:]]*200([[:space:]]*[,}])'; then
fail "$label business check failed: $url"
fi
echo "$label=200 $url"
}
changed_files="$(git status --porcelain)"
[[ -z "$changed_files" ]] || fail "worktree has uncommitted changes; commit the release batch before publishing"
@@ -90,11 +101,7 @@ if [[ -n "${RELEASE_REMOTE_URL:-}" ]]; then
remote="${RELEASE_REMOTE_URL%/}"
curl -fsS --max-time 15 "$remote/" >/dev/null || fail "remote root check failed: $remote/"
echo "remote_root=200 $remote/"
if curl -fsS --max-time 15 "$remote/prod-api/auth/tenant/list" >/dev/null; then
echo "remote_tenant_list=200 $remote/prod-api/auth/tenant/list"
else
fail "remote tenant list check failed: $remote/prod-api/auth/tenant/list"
fi
require_remote_business_success "remote_tenant_list" "$remote/prod-api/auth/tenant/list"
if [[ "${RELEASE_VERIFY_REMOTE_MATCH:-false}" == "true" ]]; then
remote_frontend_asset="$(curl -fsS --max-time 15 "$remote/" | sed -nE 's/.*src="(\/assets\/[^" ]+\.js)".*/\1/p' | head -n 1)"