docs(CUST-WP-0054-T05): Phase 4 sweep checkout migration evidence

Record railiance01 clone tree, host_paths registration, and tooling for
bulk clone and path registration. Update T05 workplan with Phase 4 completion.
This commit is contained in:
codex
2026-07-06 19:24:28 +02:00
parent 0bebad0bae
commit c9764ba73c
4 changed files with 210 additions and 1 deletions

View File

@@ -0,0 +1,73 @@
#!/usr/bin/env bash
# Bulk-clone State Hub registered repos onto railiance01 under /home/tegwick/<slug>.
# Usage: railiance01-bulk-clone-repos.sh [--dry-run] [--slug SLUG]
set -euo pipefail
API_BASE="${API_BASE:-http://127.0.0.1:8000}"
CLONE_ROOT="${CLONE_ROOT:-/home/tegwick}"
DRY_RUN=0
if [[ "${1:-}" == "--dry-run" ]]; then
DRY_RUN=1
shift
fi
SLUG_FILTER="${1:-}"
clone_url_for() {
local slug="$1" remote="$2"
case "${remote}" in
forgejo-remote:*|gitea-remote:*) echo "${remote}" ;;
ssh://git@92.205.130.254:30022/coulomb/*) echo "gitea-remote:coulomb/${slug}.git" ;;
http://92.205.130.254:32166/coulomb/*) echo "gitea-remote:coulomb/${slug}.git" ;;
http://gitea.local/worsch/*) echo "gitea-remote:coulomb/${slug}.git" ;;
"") echo "gitea-remote:coulomb/${slug}.git" ;;
*) echo "gitea-remote:coulomb/${slug}.git" ;;
esac
}
repos_json=$(curl -fsS "${API_BASE}/repos/")
mapfile -t slugs < <(python3 -c "
import json, sys
repos = json.load(sys.stdin)
filt = sys.argv[1] if len(sys.argv) > 1 else ''
for r in sorted(repos, key=lambda x: x['slug']):
if filt and r['slug'] != filt:
continue
print(r['slug'])
" <<<"${repos_json}" "${SLUG_FILTER}")
cloned=0
skipped=0
failed=0
for slug in "${slugs[@]}"; do
dest="${CLONE_ROOT}/${slug}"
if [[ -d "${dest}/.git" ]]; then
echo "SKIP ${slug} (exists)"
skipped=$((skipped + 1))
continue
fi
remote=$(python3 -c "
import json, sys
repos = json.load(sys.stdin)
for r in repos:
if r['slug'] == sys.argv[1]:
print(r.get('remote_url') or '')
break
" <<<"${repos_json}" "${slug}")
url=$(clone_url_for "${slug}" "${remote}")
if [[ "${DRY_RUN}" -eq 1 ]]; then
echo "DRY ${slug} <- ${url}"
continue
fi
echo "CLONE ${slug} <- ${url}"
if git clone "${url}" "${dest}"; then
cloned=$((cloned + 1))
else
echo "FAIL ${slug}" >&2
failed=$((failed + 1))
fi
done
echo "done: cloned=${cloned} skipped=${skipped} failed=${failed}"

View File

@@ -0,0 +1,49 @@
#!/usr/bin/env bash
# Register railiance01 host_paths for all State Hub repos.
# Usage: railiance01-register-host-paths.sh [--dry-run]
set -euo pipefail
API_BASE="${API_BASE:-http://127.0.0.1:8000}"
HOST="${RAILIANCE_HOST:-239.62.205.92.host.secureserver.net}"
CLONE_ROOT="${CLONE_ROOT:-/home/tegwick}"
DRY_RUN=0
if [[ "${1:-}" == "--dry-run" ]]; then
DRY_RUN=1
fi
repos=$(curl -fsS "${API_BASE}/repos/")
registered=0
skipped=0
while IFS= read -r slug; do
path="${CLONE_ROOT}/${slug}"
current=$(python3 -c "
import json, sys
repos = json.load(sys.stdin)
for r in repos:
if r['slug'] == sys.argv[1]:
print((r.get('host_paths') or {}).get(sys.argv[2], ''))
break
" <<<"${repos}" "${slug}" "${HOST}")
if [[ "${current}" == "${path}" ]]; then
echo "OK ${slug}"
skipped=$((skipped + 1))
continue
fi
if [[ "${DRY_RUN}" -eq 1 ]]; then
echo "DRY ${slug} host_paths[${HOST}]=${path} (was: ${current:-<empty>})"
continue
fi
curl -fsS -X POST "${API_BASE}/repos/${slug}/paths" \
-H "Content-Type: application/json" \
-d "{\"host\": \"${HOST}\", \"path\": \"${path}\"}" >/dev/null
echo "POST ${slug} -> ${path}"
registered=$((registered + 1))
done < <(python3 -c "
import json, sys
for r in sorted(json.load(sys.stdin), key=lambda x: x['slug']):
print(r['slug'])
" <<<"${repos}")
echo "done: registered=${registered} unchanged=${skipped}"