Why: an update that stops the old process and overwrites the binary cannot get the previous version back, and a migration the old binary cannot read must be refused before that stop. CI also had no fixed RDM SHA to build from. Evidence: python3 -m unittest tests.test_svc_identity tests.test_svc_recover tests.test_svc_deploy_txn tests.test_lifecycle_pin passed. make test-lifecycle exits 2 when AGENT_PG_TEST_DSN is unset. Impact: installs land in releases/<rid> and current switches with mv -T. Deploy keeps the desired state and rolls back a non-terminal journal. Schema compatFloor above the installed target is refused unless --migrate-schema --confirm is paired with a backup. test-lifecycle fails closed without PostgreSQL and an RDM checkout. Login stays NOT_RUN. Refs: recovery plan r3.1 D2 and D3; Backend feature/d1-identity-open Co-authored-by: Cursor <cursoragent@cursor.com>
26 lines
1.1 KiB
Bash
Executable File
26 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# 按 tests/integration/lifecycle/rdm.pin 取出固定 SHA。只接受 40 位 hex。
|
|
# 不执行 pin 文件,不接受 URL。检出由调用方用已允许的 RDM origin 完成。
|
|
set -euo pipefail
|
|
pin="${1:-tests/integration/lifecycle/rdm.pin}"
|
|
[ -f "$pin" ] || { echo "rdm.pin 不存在:$pin" >&2; exit 1; }
|
|
declare -A got=()
|
|
while IFS= read -r line || [ -n "$line" ]; do
|
|
case "$line" in
|
|
''|\#*) continue ;;
|
|
esac
|
|
key="${line%%=*}"
|
|
val="${line#*=}"
|
|
case "$key" in
|
|
sha|prev_sha|legacy_sha) ;;
|
|
*) echo "rdm.pin 未知键:$key" >&2; exit 1 ;;
|
|
esac
|
|
case "$val" in
|
|
[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]) ;;
|
|
*) echo "rdm.pin 的 $key 不是 40 位 hex" >&2; exit 1 ;;
|
|
esac
|
|
got["$key"]="$val"
|
|
done < "$pin"
|
|
[ "${#got[@]}" -eq 3 ] || { echo "rdm.pin 必须同时有 sha、prev_sha、legacy_sha" >&2; exit 1; }
|
|
printf '%s\n' "${got[sha]}"
|