forked from FIWARE-Ops/marinera
-
Notifications
You must be signed in to change notification settings - Fork 2
41 lines (29 loc) · 1.17 KB
/
cleanup.yaml
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
name: Delete apps and namespace after deleting branch
# trigger on branch deletion to bind the namespaces lifecycle to the branch lifecycle
on:
delete:
branches:
- 'feature-**'
jobs:
delete:
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v1
- name: Authenticate and set context
uses: redhat-actions/oc-login@v1
with:
# URL to your OpenShift cluster.
openshift_server_url: ${{ secrets.OPENSHIFT_SERVER_FIWARE }}
# Authentication Token. Can use username and password instead.
openshift_token: ${{ secrets.OPENSHIFT_TOKEN_FIWARE }}
# Disables SSL cert checking. Use this if you don't have the certificate authority data.
insecure_skip_tls_verify: true
- name: Delete applications
run: |
# remove all apps deployed for the namespace corresponding to the branch
oc delete application -l destination-namespace=${{ github.event.ref }} -n argocd
# delete the namespace associated to the trigger event's branch
- name: Delete namespace
run: |
oc delete project ${{ github.event.ref }}