-
Notifications
You must be signed in to change notification settings - Fork 304
47 lines (45 loc) · 1.69 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
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@v2
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
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
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Set Kubernetes Context
uses: azure/k8s-set-context@v1
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