Skip to content

Commit

Permalink
add debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
justin808 committed Jan 29, 2025
1 parent 751eb87 commit e113f47
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/actions/delete-control-plane-app/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ runs:
steps:
- name: Delete Application
shell: bash
run: ${{ github.action_path }}/../deploy-to-control-plane/scripts/delete-app.sh
run: ${{ github.action_path }}/scripts/delete-app.sh
env:
APP_NAME: ${{ inputs.app_name }}
CPLN_ORG: ${{ inputs.org }}
36 changes: 36 additions & 0 deletions .github/actions/delete-control-plane-app/delete-app.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

# Script to delete a Control Plane application
# Required environment variables:
# - APP_NAME: Name of the application to delete
# - CPLN_ORG: Organization name

set -e

# Validate required environment variables
: "${APP_NAME:?APP_NAME environment variable is required}"
: "${CPLN_ORG:?CPLN_ORG environment variable is required}"

# Safety check: prevent deletion of production or staging apps
if echo "$APP_NAME" | grep -iqE '(production|staging)'; then
echo "❌ ERROR: Cannot delete apps containing 'production' or 'staging' in their name" >&2
echo "🛑 This is a safety measure to prevent accidental deletion of production or staging environments" >&2
echo " App name: $APP_NAME" >&2
exit 1
fi

# Check if app exists before attempting to delete
echo "🔍 Checking if application exists: $APP_NAME"
if ! cpflow exists -a "$APP_NAME"; then
echo "⚠️ Application does not exist: $APP_NAME"
exit 0
fi

# Delete the application
echo "🗑️ Deleting application: $APP_NAME"
if ! cpflow delete -a "$APP_NAME" --force; then
echo "❌ Failed to delete application: $APP_NAME" >&2
exit 1
fi

echo "✅ Successfully deleted application: $APP_NAME"
4 changes: 4 additions & 0 deletions .github/workflows/delete-review-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ env:
PR_NUMBER: ${{ github.event.pull_request.number || github.event.issue.number }}

jobs:
debug:
uses: ./.github/workflows/debug-workflow.yml
with:
debug_enabled: false # Will still run if vars.DEBUG_WORKFLOW is true
Process-Delete-Command:
if: |
(github.event_name == 'issue_comment' &&
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/help-command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ permissions:
pull-requests: write

jobs:
debug:
uses: ./.github/workflows/debug-workflow.yml
with:
debug_enabled: false # Will still run if vars.DEBUG_WORKFLOW is true

show-help:
if: |
github.event_name == 'workflow_dispatch' ||
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/review-app-help.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ permissions:
pull-requests: write

jobs:
debug:
uses: ./.github/workflows/debug-workflow.yml
with:
debug_enabled: false # Will still run if vars.DEBUG_WORKFLOW is true

show-quick-help:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
Expand Down

0 comments on commit e113f47

Please sign in to comment.