-
Notifications
You must be signed in to change notification settings - Fork 308
48 lines (46 loc) · 1.91 KB
/
soak-test-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
name: Clean up on PR close
on:
pull_request:
types: [closed]
paths:
- 'packages/sources/**'
- 'packages/composites/**'
- 'packages/targets/**'
- 'packages/core/**'
jobs:
cleanup-ephemeral-adapters-on-pr-close:
name: Cleanup Ephemeral Adapters used for testing
runs-on: ubuntu-latest
environment: QA
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
with:
aws-access-key-id: ${{ secrets.QA_SDLC_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.QA_SDLC_AWS_SECRET_KEY }}
aws-region: ${{ secrets.QA_SDLC_AWS_REGION }}
role-to-assume: ${{ secrets.QA_SDLC_AWS_ROLE_TO_ASSUME }}
role-duration-seconds: 3600
mask-aws-account-id: true
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076 # v2.0.1
- name: Set Kubernetes Context
uses: azure/k8s-set-context@212a19233d93f03eceaac31ae5a1d1acf650b6ef # v4.0.1
with:
method: kubeconfig
kubeconfig: ${{ secrets.QA_SDLC_KUBECONFIG }}
- uses: ./.github/actions/setup # Yarn install > setup
- name: cleaning up adapters
env:
PR_NUMBER: ${{ github.event.number }}
run: |
# Build the list of adapters using the PR number
ADAPTER_NAMES=$(kubectl get deployments --namespace adapters | awk '{print $1;}' | grep "${PR_NUMBER}$" | awk -F'-' '{print $3;}')
for adapter in ${ADAPTER_NAMES}; do
# stop the k6 pod
NAME=k6-${PR_NUMBER}-${adapter} yarn qa:adapter stop k6 ${PR_NUMBER} || true
# stop the adapter pod
yarn qa:adapter stop ${adapter} ${PR_NUMBER} || true
done