生产流量处于旧失败验收 Run 的 validation 状态时,允许新验收接管任意已验证的 Git 祖先 release,而非仅允许 release manifest 的直接 base;仍保留 Run 状态、镜像 digest、revision 与当前集群 release CAS 校验。\n\n允许 pending Run 在激活前异常时直接标记为 failed,避免验收工具在 CAS 或网络错误后遗留无法结束的 Run。新增祖先关系脚本测试及临时 PostgreSQL 集成验证。\n\n验证:Go 全量测试、go vet、临时 PostgreSQL 集成测试、bash -n、ShellCheck、manual-release-test。
39 lines
1.2 KiB
Bash
Executable File
39 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
root=$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)
|
|
tmp=$(mktemp -d)
|
|
trap 'rm -rf "$tmp"' EXIT
|
|
|
|
script=$root/scripts/cluster/run-production-acceptance.sh
|
|
awk '
|
|
/^is_release_ancestor\(\)/ { capture = 1 }
|
|
capture && /^create_and_activate_run\(\)/ { exit }
|
|
capture { print }
|
|
' "$script" >"$tmp/is-release-ancestor.sh"
|
|
|
|
# shellcheck source=/dev/null
|
|
source "$tmp/is-release-ancestor.sh"
|
|
|
|
cluster_root=$tmp/repository
|
|
git init -q "$cluster_root"
|
|
git -C "$cluster_root" config user.name 'Acceptance Script Test'
|
|
git -C "$cluster_root" config user.email 'acceptance-script-test@example.invalid'
|
|
git -C "$cluster_root" commit --allow-empty -qm first
|
|
first=$(git -C "$cluster_root" rev-parse HEAD)
|
|
git -C "$cluster_root" commit --allow-empty -qm second
|
|
git -C "$cluster_root" commit --allow-empty -qm third
|
|
third=$(git -C "$cluster_root" rev-parse HEAD)
|
|
|
|
is_release_ancestor "$first" "$third"
|
|
if is_release_ancestor "$third" "$first"; then
|
|
echo 'descendant release was accepted as an ancestor' >&2
|
|
exit 1
|
|
fi
|
|
if is_release_ancestor invalid "$third"; then
|
|
echo 'invalid release identifier was accepted as an ancestor' >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo 'production_acceptance_script_tests=PASS'
|