diff --git a/.github/workflows/pr-close.yml b/.github/workflows/pr-close.yml index 0e6bee3..08dc9b2 100644 --- a/.github/workflows/pr-close.yml +++ b/.github/workflows/pr-close.yml @@ -49,6 +49,12 @@ jobs: cd charts/quickstart-openshift-emerald yq eval '.global.enabled=false' -i values-"$DEPLOYMENT_NUMBER".yaml + # We always run this to avoid deleting developer databases on commit pushes after a PR is opened + # there is a small edge case where a cleanup could be interrupted by this if 2 PRs open closely together + - name: Unset / No-op Crunchy development DB cleanup + run: | + PR_VALUES_FILEPATH=charts/quickstart-openshift-emerald/charts/database/values.yaml ./.github/scripts/crunchy.sh u + - name: Commit and push update shell: bash run: | diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 1a07085..3f0a2e6 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -73,6 +73,18 @@ jobs: yq eval '.global.enabled=true' -i values-"$DEPLOYMENT_NUMBER".yaml yq eval '.global.tag="${{ needs.builds.outputs.sha }}"' -i values-"$DEPLOYMENT_NUMBER".yaml + # We always run this to avoid deleting developer databases on commit pushes after a PR is opened + # there is a small edge case where a cleanup could be interrupted by this if 2 PRs open closely together + - name: Unset / No-op Crunchy development DB cleanup + run: | + PR_VALUES_FILEPATH=charts/quickstart-openshift-emerald/charts/database/values.yaml ./.github/scripts/crunchy.sh u + + # On a newly opened PR we drop the old database and crunchy will standup a fresh db + - name: Refresh developer database for newly opened PR + if: ${{ github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'reopened') }} + run: | + DEPLOYMENT_NUMBER=${{ steps.get-deployment-number.outputs.DEPLOYMENT_NUMBER }} + PR_VALUES_FILEPATH=charts/quickstart-openshift-emerald/charts/database/values.yaml ./.github/scripts/crunchy.sh s $DEPLOYMENT_NUMBER - name: Commit and push update shell: bash