Skip to content

Commit 3352e90

Browse files
committed
recreate app deletion script
1 parent f70de80 commit 3352e90

File tree

4 files changed

+25
-15
lines changed

4 files changed

+25
-15
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Delete Control Plane App
2+
description: 'Deletes a Control Plane application and all its resources'
3+
4+
inputs:
5+
app_name:
6+
description: 'Name of the application to delete'
7+
required: true
8+
cpln_org:
9+
description: 'Organization name'
10+
required: true
11+
12+
runs:
13+
using: "composite"
14+
steps:
15+
- name: Delete Application
16+
shell: bash
17+
run: ${{ github.action_path }}/delete-app.sh
18+
env:
19+
APP_NAME: ${{ inputs.app_name }}
20+
CPLN_ORG: ${{ inputs.cpln_org }}

.github/actions/deploy-to-control-plane/scripts/delete-app.sh renamed to .github/actions/delete-control-plane-app/delete-app.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ fi
2121

2222
# Check if app exists before attempting to delete
2323
echo "🔍 Checking if application exists: $APP_NAME"
24-
if ! cpflow exists -a "$APP_NAME"; then
24+
if ! cpflow exists -a "$APP_NAME" --org "$CPLN_ORG"; then
2525
echo "⚠️ Application does not exist: $APP_NAME"
2626
exit 0
2727
fi
2828

2929
# Delete the application
3030
echo "🗑️ Deleting application: $APP_NAME"
31-
if ! cpflow delete -a "$APP_NAME" --force; then
31+
if ! cpflow delete -a "$APP_NAME" --org "$CPLN_ORG" --force; then
3232
echo "❌ Failed to delete application: $APP_NAME" >&2
3333
exit 1
3434
fi

.github/workflows/delete-review-app.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,7 @@ jobs:
145145
uses: ./.github/actions/delete-control-plane-app
146146
with:
147147
app_name: ${{ env.APP_NAME }}
148-
org: ${{ env.CPLN_ORG }}
149-
github_token: ${{ secrets.GITHUB_TOKEN }}
150-
env:
151-
APP_NAME: ${{ env.APP_NAME }}
152-
CPLN_ORG: ${{ secrets.CPLN_ORG }}
153-
CPLN_TOKEN: ${{ secrets.CPLN_TOKEN }}
148+
org: ${{ vars.CPLN_ORG_STAGING }}
154149

155150
- name: Update Delete Status
156151
if: always()

.github/workflows/nightly-remove-stale-review-apps.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,7 @@ jobs:
4848
run: |
4949
for pr in $(echo "${{ steps.stale_prs.outputs.result }}" | jq -r '.[]'); do
5050
APP_NAME="qa-react-webpack-rails-tutorial-pr-$pr"
51+
CPLN_ORG=${{ vars.CPLN_ORG_STAGING }}
5152
echo "🗑️ Deleting stale review app for PR #$pr: $APP_NAME"
52-
${{ github.workspace }}/.github/actions/deploy-to-control-plane/scripts/delete-app.sh
53+
${{ github.workspace }}/.github/actions/delete-control-plane-app/scripts/delete-app.sh
5354
done
54-
env:
55-
APP_NAME: qa-react-webpack-rails-tutorial-pr-${{ steps.stale_prs.outputs.result }}
56-
57-
- name: Run cleanup-images script
58-
run: |
59-
cpflow cleanup-images -a qa-react-webpack-rails-tutorial -y

0 commit comments

Comments
 (0)