-
Notifications
You must be signed in to change notification settings - Fork 33
48 lines (47 loc) · 1.47 KB
/
pr-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
42
43
44
45
46
47
48
name: PRCleanup
on:
pull_request:
types: [closed]
jobs:
deployment:
runs-on: 'ubuntu-latest'
steps:
-
name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
with:
submodules: recursive
-
name: 'Install Helm'
uses: azure/setup-helm@v4
with:
version: v3.6.2
-
name: Install Kubectl
uses: azure/setup-kubectl@v4
with:
version: v1.21.2
-
name: Create KUBECONFIG
env:
KUBE_CONFIG: '${{ secrets.KUBECONFIG_TEST_AV2 }}'
run: |
mkdir -p $HOME/.kube
echo "$KUBE_CONFIG" > $HOME/.kube/config
-
name: Remove PR Environment Helm Release
env:
TRAINING_HELM_RELEASE: 'pr-${{ github.event.pull_request.number }}'
TRAINING_NAMESPACE: 'pitc-cicd-jenkins-techlab-test'
TRAINING_VERSION: '${{ github.sha }}'
run: |
helm uninstall $TRAINING_HELM_RELEASE --kubeconfig $HOME/.kube/config --namespace=$TRAINING_NAMESPACE
-
name: Delete Tags on Quay
id: delete_tags
env:
PR_NUMBER: '${{ github.event.pull_request.number }}'
QUAYIO_API_TOKEN: '${{ secrets.QUAYIO_API_TOKEN }}'
REPOSITORY: '${{ github.repository }}'
run: |
curl -X DELETE -H "Authorization: Bearer ${QUAYIO_API_TOKEN}" https://quay.io/api/v1/repository/${REPOSITORY}/tag/pr-${PR_NUMBER}