From a3f4c6facfa101dca8607bf97beb92df776d3a4b Mon Sep 17 00:00:00 2001 From: saravanakumardb1 Date: Tue, 24 Mar 2026 12:17:45 -0700 Subject: [PATCH] fix(infra): fix sequential phase gap + add phase 7 guards MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. last_completed_phase now stops at first gap — prevents --resume from skipping phases when --phase=N created non-sequential markers 2. Phase 7 fails early if .env.ecosystem is missing (points to --phase=6) 3. Warns if compose config JSON cache fails — graceful degradation --- docs/devops/single_azure_vm/setup.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/devops/single_azure_vm/setup.sh b/docs/devops/single_azure_vm/setup.sh index eb46d6ba..f7ee7f33 100755 --- a/docs/devops/single_azure_vm/setup.sh +++ b/docs/devops/single_azure_vm/setup.sh @@ -99,7 +99,8 @@ is_phase_done() { last_completed_phase() { local last=0 for i in 1 2 3 4 5 6 7 8; do - is_phase_done "$i" && last=$i + # Stop at first gap — phases must be sequential + is_phase_done "$i" && last=$i || break done echo "$last" } @@ -564,6 +565,11 @@ phase7_deploy() { setup_compose_env local plat_dir="${INSTALL_DIR}/learning_ai_common_plat" + + # Guard: .env.ecosystem must exist (created by phase 6) + if [ ! -f "${plat_dir}/.env.ecosystem" ]; then + fail "Missing ${plat_dir}/.env.ecosystem — run phase 6 first: sudo ./setup.sh --phase=6" + fi local build_ok=() build_fail=() build_skip=() mkdir -p "${STATE_DIR}/builds" @@ -580,6 +586,11 @@ phase7_deploy() { compose_json=$(docker compose -f "${plat_dir}/${COMPOSE_FILE}" \ --env-file "${plat_dir}/.env.ecosystem" config --format json 2>/dev/null || true) + if [ -z "$compose_json" ]; then + warn " Could not parse compose config (docker compose config --format json failed)." + warn " Per-service build detection disabled — all services will attempt to build." + fi + for svc in "${all_services[@]}"; do idx=$((idx + 1))