-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5d46da5
commit 097cec2
Showing
4 changed files
with
60 additions
and
63 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Tools environment cleanup | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
tools-cleanup: | ||
name: Cleanup tools environment | ||
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 |
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
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
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