-
Notifications
You must be signed in to change notification settings - Fork 2
52 lines (49 loc) · 1.68 KB
/
schedule-reap-aws-dev.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
49
50
51
52
name: Scheduled reap AWS dev accounts
env:
IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/reaper
AWS_DEFAULT_REGION: us-east-1
on:
schedule:
- cron: '0 2 * * *'
jobs:
docker:
uses: ./.github/workflows/docker-build.yml
secrets:
GHCR_BOT_USERNAME: ${{ secrets.GHCR_BOT_USERNAME }}
GHCR_BOT_TOKEN: ${{ secrets.GHCR_BOT_TOKEN }}
reap-aws-dev:
strategy:
fail-fast: false
matrix:
account:
- {id: DEV01_ID, key: DEV01_KEY}
- {id: DEV02_ID, key: DEV02_KEY}
- {id: DEV03_ID, key: DEV03_KEY}
- {id: DEV04_ID, key: DEV04_KEY}
- {id: DEV05_ID, key: DEV05_KEY}
- {id: DEV06_ID, key: DEV06_KEY}
- {id: DEV07_ID, key: DEV07_KEY}
- {id: DEV08_ID, key: DEV08_KEY}
- {id: DEV09_ID, key: DEV09_KEY}
- {id: DEV10_ID, key: DEV10_KEY}
- {id: DEV11_ID, key: DEV11_KEY}
name: reap AWS dev
needs: [docker]
runs-on: ubuntu-latest
container:
image: ghcr.io/quipucords/reaper:latest
credentials:
username: ${{ secrets.GHCR_BOT_USERNAME }}
password: ${{ secrets.GHCR_BOT_TOKEN }}
env:
AWS_ACCESS_KEY_ID: ${{ secrets[matrix.account.id] }}
AWS_SECRET_ACCESS_KEY: ${{ secrets[matrix.account.key] }}
WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }}
steps:
- run: |
cd /opt/reaper
export AWS_DEFAULT_REGION AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY
export REAP_AGE_SNAPSHOTS REAP_AGE_VOLUMES REAP_DRYRUN REAP_BYPASS_TAG WEBHOOK_URL
poetry run sh ./bin/aws-zero-autoscaling.sh
poetry run sh ./bin/aws-stop-instances.sh
poetry run python -m reaper.aws_delete