File tree Expand file tree Collapse file tree 5 files changed +51
-1
lines changed
actions/delete-control-plane-app Expand file tree Collapse file tree 5 files changed +51
-1
lines changed Original file line number Diff line number Diff line change 1414 steps :
1515 - name : Delete Application
1616 shell : bash
17- run : ${{ github.action_path }}/../deploy-to-control-plane/ scripts/delete-app.sh
17+ run : ${{ github.action_path }}/scripts/delete-app.sh
1818 env :
1919 APP_NAME : ${{ inputs.app_name }}
2020 CPLN_ORG : ${{ inputs.org }}
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 "
Original file line number Diff line number Diff line change 1919 PR_NUMBER : ${{ github.event.pull_request.number || github.event.issue.number }}
2020
2121jobs :
22+ debug :
23+ uses : ./.github/workflows/debug-workflow.yml
24+ with :
25+ debug_enabled : false # Will still run if vars.DEBUG_WORKFLOW is true
2226 Process-Delete-Command :
2327 if : |
2428 (github.event_name == 'issue_comment' &&
Original file line number Diff line number Diff line change @@ -18,6 +18,11 @@ permissions:
1818 pull-requests : write
1919
2020jobs :
21+ debug :
22+ uses : ./.github/workflows/debug-workflow.yml
23+ with :
24+ debug_enabled : false # Will still run if vars.DEBUG_WORKFLOW is true
25+
2126 show-help :
2227 if : |
2328 github.event_name == 'workflow_dispatch' ||
Original file line number Diff line number Diff line change @@ -9,6 +9,11 @@ permissions:
99 pull-requests : write
1010
1111jobs :
12+ debug :
13+ uses : ./.github/workflows/debug-workflow.yml
14+ with :
15+ debug_enabled : false # Will still run if vars.DEBUG_WORKFLOW is true
16+
1217 show-quick-help :
1318 if : github.event_name == 'pull_request'
1419 runs-on : ubuntu-latest
You can’t perform that action at this time.
0 commit comments