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