ci!: deployment config deprecation, image stream removal #1204
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PR Closed | |
on: | |
pull_request: | |
types: [closed] | |
concurrency: | |
# PR open and close use the same group, allowing only one at a time | |
group: ${{ github.event.number }} | |
cancel-in-progress: true | |
jobs: | |
cleanup: | |
name: Cleanup and Images | |
uses: bcgov/quickstart-openshift-helpers/.github/workflows/[email protected] | |
secrets: | |
oc_namespace: ${{ secrets.OC_NAMESPACE }} | |
oc_token: ${{ secrets.OC_TOKEN }} | |
with: | |
cleanup: label | |
packages: backend database frontend legacy processor | |
tools-cleanup: | |
name: Cleanup tools environment | |
needs: [cleanup] | |
environment: tools | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Install CLI tools from OpenShift Mirror | |
uses: redhat-actions/openshift-tools-installer@v1 | |
with: | |
oc: "4.13" | |
- name: Remove the PR database | |
continue-on-error: true | |
run: | | |
oc login --token=${{ secrets.OC_TOKEN }} --server=${{ secrets.OC_SERVER }} | |
oc project ${{ secrets.OC_NAMESPACE }} # Safeguard! | |
# This removes a new pluggable database, user and service for the PR | |
for i in {1..5}; do | |
POD_NAME=$(oc get pods -l app=nr-forest-client-tools -l deployment=nr-forest-client-tools-legacydb -o jsonpath='{.items[0].metadata.name}' 2>/dev/null) | |
if [ -n "$POD_NAME" ]; then | |
echo "Pod found: $POD_NAME" | |
oc exec $POD_NAME -- /opt/oracle/removeDatabase "THE" "PR_${{ github.event.number }}" | |
break | |
else | |
echo "Pod not found, retrying in 10 seconds... ($i/5)" | |
sleep 10 | |
fi | |
done | |
if [ -z "$POD_NAME" ]; then | |
echo "Failed to find the pod after 5 attempts." | |
fi |