Skip to content

Commit

Permalink
feat: adding extra parameter remove pvc (#69)
Browse files Browse the repository at this point in the history
Co-authored-by: Derek Roberts <derek.roberts@gmail.com>
  • Loading branch information
mishraomp and DerekRoberts committed Sep 5, 2024
1 parent 268332f commit 968dfc4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
21 changes: 15 additions & 6 deletions .github/workflows/.pr-close.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ on:
description: 'Space-separated list of packages to promote'
required: false
type: string
remove_pvc:
required: false
default: data-${{ inputs.repository }}-${{ inputs.target }}-bitnami-pg-0
type: string
description: 'Comma separated list of PVCs to remove'

### Usually a bad idea / not recommended
merge_branch:
Expand Down Expand Up @@ -110,7 +115,6 @@ jobs:
echo "RETRY=false" >> $GITHUB_ENV
fi
- uses: shrink/actions-docker-registry-tag@v4
if: env.RETRY == 'true'
with:
Expand Down Expand Up @@ -154,11 +158,7 @@ jobs:
# If found, then remove
helm status ${{ env.release }} && helm uninstall --no-hooks ${{ env.release }} || \
echo "Not found: ${{ env.release }}"
# Remove Bitnami Crunchy PVCs
oc delete pvc data-${{ env.release }}-bitnami-pg-0 || \
echo "Not found: pvc data-${{ env.release }}-bitnami-pg-0"
# Cleanup for OpenShift template deployments, uses labels
- name: Label
if: inputs.cleanup == 'label'
Expand All @@ -167,3 +167,12 @@ jobs:
# Remove old build runs, build pods and deployment pods
oc delete all,cm,pvc,secret -l app=${{ inputs.repository }}-${{ inputs.target }}
# Remove PVCs from OpenShift when PR closed
- name: Remove PVCs
if: inputs.remove_pvc
run: |
# Remove PVCs
echo "${{ inputs.remove_pvc }}" | while IFS= read -r pvc; do
oc delete pvc ${pvc//,/} || echo "Not found: ${pvc//,/}"
done
8 changes: 8 additions & 0 deletions .github/workflows/pr-open.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ concurrency:
cancel-in-progress: true

jobs:
testing:
name: Testing
uses: ./.github/workflows/.pr-close.yml
with:
remove_pvc: |
frontend,
backend
validate:
name: Validate
uses: ./.github/workflows/.pr-validate.yml
Expand Down

0 comments on commit 968dfc4

Please sign in to comment.