1
0
mirror of git://f0xx.org/ac/ac-deploy synced 2026-07-29 02:18:40 +03:00
Files
ac-deploy/sim/cluster0/scripts/validate-ac-repos.sh
Anton Afanasyeu 56a6cd785d fix(cluster0): preserve issues layout overlay and validate rsync deploy
Compose ac-be-issues views last so tickets/graphs stubs no longer overwrite
the canonical nav shell (monitor link). validate-ac-repos accepts /mnt/repos/ac
lab checkout and unset url-shortener origin.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-05 18:28:46 +02:00

112 lines
3.4 KiB
Bash
Executable File

#!/bin/sh
# Validate ac-workspace + composed backend on this cluster node (ac/* only).
set -eu
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
# shellcheck source=/dev/null
. "$ROOT/scripts/lib/common.sh"
load_cluster_env
FAIL=0
check_dir() {
_label="$1"
_path="$2"
if [ -d "$_path" ]; then
log "OK ${_label} ${_path}"
else
log "FAIL missing ${_label} ${_path}"
FAIL=1
fi
}
check_file() {
_label="$1"
_path="$2"
if [ -f "$_path" ]; then
log "OK ${_label}"
else
log "FAIL missing ${_label} ${_path}"
FAIL=1
fi
}
AC_ROOT="${AC_WORKSPACE_ROOT:-/var/www/ac/workspace}"
LEGACY="${APP_ROOT}/android_cast"
HUB="${APP_ROOT}/index.php"
log "validate-ac-repos on $(host_short)"
check_dir "ac-workspace" "$AC_ROOT"
check_dir "ac-platform-db" "${AC_ROOT}/ac-platform-db/sql/crash_reporter"
check_dir "ac-platform-php" "${AC_ROOT}/ac-platform-php/src"
check_dir "ac-platform-web" "${AC_ROOT}/ac-platform-web/assets/css"
check_dir "composed-backend" "${COMPOSE_BACKEND:-/var/www/ac/composed/backend}"
check_file "composed-index" "${COMPOSE_BACKEND:-/var/www/ac/composed/backend}/public/index.php"
check_file "hub-index" "$HUB"
check_file "hub-logo-svg" "${APP_ROOT}/assets/hub-logo-transparent.svg"
check_file "hub-globe-svg" "${APP_ROOT}/assets/hub-logo-fragment-globe.svg"
check_dir "url-shortener" "${URL_SHORTENER_ROOT:-/var/www/url-shortener}/public"
if [ -d "${LEGACY}/.git" ]; then
_url="$(git -C "$LEGACY" config --get remote.origin.url 2>/dev/null || true)"
log "FAIL legacy monolith present at $LEGACY ($_url) — run purge-legacy-monolith.sh"
FAIL=1
elif [ -e "$LEGACY" ]; then
if [ -d "${LEGACY}/examples/platform" ] && [ ! -d "${LEGACY}/.git" ]; then
log "OK hub platform stub at ${LEGACY}/examples/platform (not monolith)"
else
log "FAIL legacy path still exists at $LEGACY (not a git checkout)"
FAIL=1
fi
else
log "OK no legacy monolith at $LEGACY"
fi
URL_ROOT="${URL_SHORTENER_ROOT:-/var/www/url-shortener}"
if [ -d "${URL_ROOT}/.git" ]; then
_url="$(git -C "$URL_ROOT" config --get remote.origin.url 2>/dev/null || true)"
if [ -z "$_url" ]; then
log "OK url-shortener (origin unset — lab checkout)"
else
case "$_url" in
git://f0xx.org/ac/*|git://f0xx.org/ac/ac-ms-url-shortener|git://10.7.0.10/ac/*|git://10.7.0.10/ac/ac-ms-url-shortener)
log "OK url-shortener origin $_url"
;;
*)
log "FAIL url-shortener wrong origin $_url (expect git://f0xx.org/ac/ac-ms-url-shortener)"
FAIL=1
;;
esac
fi
fi
REPOS_AC="/mnt/repos/ac"
if [ -d "${REPOS_AC}/.git" ]; then
_root="$(git -C "$REPOS_AC" config --get remote.origin.url 2>/dev/null || true)"
log "ac-root origin=${_root} sha=$(git -C "$REPOS_AC" rev-parse --short HEAD 2>/dev/null || echo none)"
case "$_root" in
git://f0xx.org/ac|git://10.7.0.10/ac) ;;
*)
log "FAIL ac-root wrong origin $_root"
FAIL=1
;;
esac
elif [ -d "${AC_ROOT}/.git" ]; then
_ws="$(git -C "$AC_ROOT" config --get remote.origin.url 2>/dev/null || true)"
log "ac-workspace origin=${_ws} sha=$(git -C "$AC_ROOT" rev-parse --short HEAD 2>/dev/null || echo none)"
case "$_ws" in
git://f0xx.org/ac/ac-workspace|git://10.7.0.10/ac/ac-workspace) ;;
*)
log "FAIL ac-workspace wrong origin $_ws"
FAIL=1
;;
esac
else
log "OK ac-workspace rsync tree at ${AC_ROOT} (deploy via /mnt/repos/ac)"
fi
if [ "$FAIL" -eq 0 ]; then
log "validate-ac-repos_ok"
exit 0
fi
log "validate-ac-repos_FAILED"
exit 1