修复 Pingora 部署检查误报

显式传播 systemd 与 EnvironmentFile 提取失败,首错后立即终止部署检查
补充 direct-entry 与 systemctl cat 失败回归,阻止空环境连带误报
同步记录旧 release 残留 capability 的安全清理与验收口径
This commit is contained in:
2026-07-10 16:20:21 +08:00
parent 09fec601b1
commit c483980c9c
4 changed files with 90 additions and 13 deletions
+21 -13
View File
@@ -319,19 +319,25 @@ extract_pingora_env_files_from_unit() {
find_pingora_gateway_env_file() {
local service_name="$1"
local env_file listen
local env_file listen unit_env_files
while IFS= read -r env_file; do
if [[ "${env_file}" != /* ]]; then
echo "[production-api-deploy] Pingora EnvironmentFile 必须使用绝对路径: ${env_file}" >&2
exit 1
fi
listen="$(read_env_value "${env_file}" "GENARRATIVE_PINGORA_GATEWAY_LISTEN")"
if [[ -n "${listen}" ]]; then
printf "%s\n" "${env_file}"
return
fi
done < <(extract_pingora_env_files_from_unit "${service_name}")
if ! unit_env_files="$(extract_pingora_env_files_from_unit "${service_name}")"; then
return 1
fi
if [[ -n "${unit_env_files}" ]]; then
while IFS= read -r env_file; do
if [[ "${env_file}" != /* ]]; then
echo "[production-api-deploy] Pingora EnvironmentFile 必须使用绝对路径: ${env_file}" >&2
exit 1
fi
listen="$(read_env_value "${env_file}" "GENARRATIVE_PINGORA_GATEWAY_LISTEN")"
if [[ -n "${listen}" ]]; then
printf "%s\n" "${env_file}"
return
fi
done <<< "${unit_env_files}"
fi
echo "[production-api-deploy] Pingora systemd 配置缺少包含 GENARRATIVE_PINGORA_GATEWAY_LISTEN 的 EnvironmentFile: ${service_name}" >&2
exit 1
@@ -363,7 +369,9 @@ check_pingora_shadow_service_config() {
local service_name="$1"
local env_file
env_file="$(find_pingora_gateway_env_file "${service_name}")"
if ! env_file="$(find_pingora_gateway_env_file "${service_name}")"; then
return 1
fi
require_pingora_shadow_env "${env_file}"
printf "%s\n" "${env_file}"
}