Files
kefu/deploy/patient-session-20260918/01-patient-preflight.sh
T
2026-09-21 10:34:06 +08:00

23 lines
1.2 KiB
Bash

#!/usr/bin/env bash
set -euo pipefail
test "${PATIENT_RELEASE_APPROVED:-}" = patient-session-20260918
release=/home/ps/patient-session-20260918
cd "$release"
python3 -c 'import json;from pathlib import Path;p=json.loads(Path("patient-release-plan.json").read_text());assert p["finalized"] is True and p["schemaMigration"] is False'
python3 patient_server_guard.py baseline
test ! -e source-before
test ! -e preflight-complete
if docker image inspect zyt/wecom-admin:before-patient-session-20260918 >/dev/null 2>&1; then echo 'Refuse to replace existing rollback tag' >&2; exit 1; fi
mkdir -m 700 source-before
python3 - <<'PY'
from pathlib import Path
import shutil,json
r=Path('/home/ps/patient-session-20260918')
p=json.loads((r/'patient-release-plan.json').read_text())
for name in p['backendFiles']:shutil.copy2(Path('/opt/im-admin/wechat_rpa')/name,r/'source-before'/name)
shutil.copy2('/opt/im-admin/deploy/im-admin/compose.yaml',r/'source-before/compose.yaml')
PY
docker tag zyt/wecom-admin:current zyt/wecom-admin:before-patient-session-20260918
docker image inspect zyt/wecom-admin:current --format '{{.Id}}' > image-before.txt
printf '%s\n' ready > preflight-complete