-
Notifications
You must be signed in to change notification settings - Fork 455
62 lines (51 loc) · 1.72 KB
/
test-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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: Test cleanup
on:
workflow_dispatch:
inputs:
clusterId:
description: 'Cluster ID'
required: true
permissions:
id-token: write
contents: read
jobs:
build:
name: cleanup
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '17'
- name: Install utilities
run: |
sudo apt install -y gettext
mkdir -p ${HOME}/.local/bin
wget https://github.com/jckuester/awsweeper/releases/download/v0.12.0/awsweeper_0.12.0_linux_amd64.tar.gz
tar zxf awsweeper_0.12.0_linux_amd64.tar.gz
mv awsweeper_0.12.0_linux_amd64/awsweeper ${HOME}/.local/bin
wget https://github.com/eksctl-io/eksctl/releases/download/v0.150.0/eksctl_Linux_amd64.tar.gz
tar zxf eksctl_Linux_amd64.tar.gz
mv eksctl ${HOME}/.local/bin
chmod +x ${HOME}/.local/bin/*
echo "${HOME}/.local/bin" >> $GITHUB_PATH
- name: Get AWS credentials
uses: aws-actions/[email protected]
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
role-duration-seconds: 3600
aws-region: ${{ secrets.AWS_REGION }}
role-session-name: GithubActionsSession
- name: Cleanup environment
timeout-minutes: 60
env:
CLUSTER_ID: ${{ github.event.inputs.clusterId }}
AWS_REGION: "${{ secrets.AWS_REGION }}"
run: |
export CLEANUP_ENVIRONMENT_NAME="$CLUSTER_ID"
export AWS_DEFAULT_REGION="$AWS_REGION"
envsubst < hack/lib/filter.yml > filter.yml
cat filter.yml
awsweeper --force filter.yml
make destroy-infrastructure environment="$CLUSTER_ID"