diff --git a/scripts/cleanup-old-runs.sh b/scripts/cleanup-old-runs.sh new file mode 100644 index 0000000..1a1479a --- /dev/null +++ b/scripts/cleanup-old-runs.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash +# cleanup-old-runs.sh — Delete legacy Cloud Run services from pre-OSVauco era +# Run once: source .env && bash scripts/cleanup-old-runs.sh +set -euo pipefail + +: "${PROJECT_ID:?Set PROJECT_ID}" +: "${REGION:?Set REGION}" + +SERVICES=( + "genai-app-vaucooscommandhub-l" + "genai-app-vaucooscommandhub-dev" + "opax-mcp-core" + "vauco-os-codeoss-chat" +) + +echo "=== Deleting legacy Cloud Run services ===" +echo " Project: $PROJECT_ID" +echo " Region: $REGION" +echo "" + +for SVC in "${SERVICES[@]}"; do + if gcloud run services describe "$SVC" \ + --project="$PROJECT_ID" \ + --region="$REGION" &>/dev/null; then + gcloud run services delete "$SVC" \ + --project="$PROJECT_ID" \ + --region="$REGION" \ + --quiet + echo " [OK] Deleted: $SVC" + else + echo " [--] Not found (already gone): $SVC" + fi +done + +echo "" +echo "=== Cleanup COMPLETE ==="