-
Notifications
You must be signed in to change notification settings - Fork 9
69 lines (58 loc) · 2.18 KB
/
cleanup.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: Cleanup
on:
pull_request:
types: [closed]
branches:
- main
jobs:
cleanup-non-db:
name: Delete non-DB resources associated with pr
runs-on: ubuntu-22.04
steps:
- name: Set Variables
shell: bash
run: |
echo "SUFFIX=pr-${{ github.event.number }}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v3
- name: Clean up - dev (OCP4)
shell: bash
run: |
oc login "${{ secrets.OPENSHIFT_CLUSTER }}" --token="${{ secrets.OC4_DEV_TOKEN }}"
PROJ_TARGET=e1e498-dev bash openshift/scripts/oc_cleanup.sh ${SUFFIX} apply
- name: Clean up - tools (OCP4)
shell: bash
run: |
oc login "${{ secrets.OPENSHIFT_CLUSTER }}" --token="${{ secrets.OC4_TOOL_TOKEN }}"
bash openshift/scripts/oc_cleanup_tools.sh ${SUFFIX} apply
- name: Clean up - test (OCP4)
shell: bash
run: |
oc login "${{ secrets.OPENSHIFT_CLUSTER }}" --token="${{ secrets.OC4_TEST_TOKEN }}"
PROJ_TARGET=e1e498-test bash openshift/scripts/oc_cleanup.sh ${SUFFIX} apply
cleanup-db:
name: Delete DB resources associated with PR
needs: cleanup-non-db
runs-on: ubuntu-22.04
steps:
- name: Set Variables
shell: bash
run: |
echo "SUFFIX=pr-${{ github.event.number }}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v3
- name: Clean up dev database
shell: bash
run: |
oc login "${{ secrets.OPENSHIFT_CLUSTER }}" --token="${{ secrets.OC4_DEV_TOKEN }}"
PROJ_TARGET=e1e498-dev bash openshift/scripts/oc_cleanup_db.sh ${SUFFIX} apply
- name: Clean up test database
shell: bash
run: |
oc login "${{ secrets.OPENSHIFT_CLUSTER }}" --token="${{ secrets.OC4_TEST_TOKEN }}"
PROJ_TARGET=e1e498-test bash openshift/scripts/oc_cleanup_db.sh ${SUFFIX} apply
- name: Clean up s3 backups in object store
shell: bash
run: |
oc login "${{ secrets.OPENSHIFT_CLUSTER }}" --token="${{ secrets.OC4_DEV_TOKEN }}"
PROJ_TARGET=e1e498-dev bash openshift/scripts/oc_provision_backup_s3_cleanup.sh ${SUFFIX}