-
Notifications
You must be signed in to change notification settings - Fork 43
74 lines (64 loc) · 2.6 KB
/
pr-closed.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: Close PR
# only trigger on pull request closed events
on:
pull_request_target:
types: [ closed ]
env:
CLUSTER_NAME: activiti
CLUSTER_DOMAIN: envalfresco.com
GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }}
jobs:
cleanup:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
messaging-broker: [rabbitmq, kafka]
messaging-partitioned: [partitioned, non-partitioned]
messaging-destinations: [default-destinations, override-destinations]
steps:
- name: Set up kubectl
uses: azure/setup-kubectl@3e0aec4d80787158d308d7b364cb1b702e7feb7f # v3
with:
version: v1.19.6
- name: Set up rancher
uses: Alfresco/alfresco-build-tools/.github/actions/setup-rancher-cli@231ca442a35bf41dbda3c9960d74e8d703c208f4 # v8.2.0
with:
url: ${{ secrets.RANCHER2_URL }}
access-key: ${{ secrets.RANCHER2_ACCESS_KEY }}
secret-key: ${{ secrets.RANCHER2_SECRET_KEY }}
context: ${{ env.CLUSTER_NAME }}
- name: Set PREVIEW_NAME env variable
id: set-preview-name
env:
MESSAGING_BROKER: ${{ matrix.messaging-broker }}
MESSAGING_PARTITIONED: ${{ matrix.messaging-partitioned }}
MESSAGING_DESTINATIONS: ${{ matrix.messaging-destinations }}
run: |
test ${GITHUB_PR_NUMBER} && PREVIEW_NAME=pr-${GITHUB_PR_NUMBER} || PREVIEW_NAME=gh-$GITHUB_RUN_NUMBER
echo "PREVIEW_NAME=$PREVIEW_NAME-${MESSAGING_BROKER:0:6}-${MESSAGING_PARTITIONED:0:1}-${MESSAGING_DESTINATIONS:0:1}" >> $GITHUB_ENV
- name: Delete preview for ${{ matrix.messaging-broker }}
run: |
echo PR #${{ github.event.pull_request.number }} has been closed
kubectl delete ns $PREVIEW_NAME || true
cleanup-test-images:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set PREVIEW_NAME env variable
id: set-preview-name
run: |
test ${GITHUB_PR_NUMBER} && PREVIEW_NAME=pr-${GITHUB_PR_NUMBER} || PREVIEW_NAME=gh-$GITHUB_RUN_NUMBER
echo set PREVIEW_NAME=$PREVIEW_NAME
echo "PREVIEW_NAME=$PREVIEW_NAME" >> $GITHUB_ENV
- name: Set preview version
run: |
echo 0.0.1-$PREVIEW_NAME-SNAPSHOT > VERSION
- name: Delete Docker images
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
run: |
echo "Delete Docker images"
make docker-delete-all