File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
.github/actions/deploy-to-control-plane/scripts Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 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 "
You can’t perform that action at this time.
0 commit comments