Skip to content

Commit f70de80

Browse files
committed
restore script
1 parent 409365f commit f70de80

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
3+
# Script to delete a Control Plane application
4+
# Required environment variables:
5+
# - APP_NAME: Name of the application to delete
6+
# - CPLN_ORG: Organization name
7+
8+
set -e
9+
10+
# Validate required environment variables
11+
: "${APP_NAME:?APP_NAME environment variable is required}"
12+
: "${CPLN_ORG:?CPLN_ORG environment variable is required}"
13+
14+
# Safety check: prevent deletion of production or staging apps
15+
if echo "$APP_NAME" | grep -iqE '(production|staging)'; then
16+
echo "❌ ERROR: Cannot delete apps containing 'production' or 'staging' in their name" >&2
17+
echo "🛑 This is a safety measure to prevent accidental deletion of production or staging environments" >&2
18+
echo " App name: $APP_NAME" >&2
19+
exit 1
20+
fi
21+
22+
# Check if app exists before attempting to delete
23+
echo "🔍 Checking if application exists: $APP_NAME"
24+
if ! cpflow exists -a "$APP_NAME"; then
25+
echo "⚠️ Application does not exist: $APP_NAME"
26+
exit 0
27+
fi
28+
29+
# Delete the application
30+
echo "🗑️ Deleting application: $APP_NAME"
31+
if ! cpflow delete -a "$APP_NAME" --force; then
32+
echo "❌ Failed to delete application: $APP_NAME" >&2
33+
exit 1
34+
fi
35+
36+
echo "✅ Successfully deleted application: $APP_NAME"

0 commit comments

Comments
 (0)