9c2f02db25
为所有 npm ci 增加整命令级有界重试。 补齐 AI 游戏创作 npm 与 Cargo 依赖缓存闭合验证。 更新可信 CI 镜像、缓存漂移告警和 Runner 运维文档。 记录 Actions Gateway CONNECT 断连崩溃的处理与验证边界。
27 lines
714 B
Bash
Executable File
27 lines
714 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
max_attempts="${GENARRATIVE_CI_NPM_CI_ATTEMPTS:-3}"
|
|
base_delay_seconds="${GENARRATIVE_CI_NPM_CI_RETRY_DELAY_SECONDS:-5}"
|
|
|
|
if [[ ! "${max_attempts}" =~ ^[1-9][0-9]*$ ]]; then
|
|
echo 'GENARRATIVE_CI_NPM_CI_ATTEMPTS must be a positive integer.' >&2
|
|
exit 2
|
|
fi
|
|
if [[ ! "${base_delay_seconds}" =~ ^[0-9]+$ ]]; then
|
|
echo 'GENARRATIVE_CI_NPM_CI_RETRY_DELAY_SECONDS must be a non-negative integer.' >&2
|
|
exit 2
|
|
fi
|
|
|
|
for attempt in $(seq 1 "${max_attempts}"); do
|
|
if npm ci "$@"; then
|
|
exit 0
|
|
fi
|
|
if [[ "${attempt}" -eq "${max_attempts}" ]]; then
|
|
echo "npm ci failed after ${max_attempts} attempts." >&2
|
|
exit 1
|
|
fi
|
|
sleep "$((attempt * base_delay_seconds))"
|
|
done
|