-
Notifications
You must be signed in to change notification settings - Fork 1
38 lines (31 loc) · 1.34 KB
/
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
name: cleanup
on: delete
jobs:
sceptre-delete:
name: Delete CloudFormation stacks using sceptre
runs-on: ubuntu-latest
environment: develop
permissions:
id-token: write
contents: read
steps:
- name: Setup code, pipenv, aws
uses: Sage-Bionetworks/action-pipenv-aws-setup@v3
with:
role_to_assume: ${{ vars.AWS_CREDENTIALS_IAM_ROLE }}
role_session_name: GitHubActions-${{ github.repository_owner }}-${{ github.event.repository.name }}-${{ github.run_id }}
python_version: 3.9
- name: Delete S3 event notification for this namespace
uses: gagoar/invoke-aws-lambda@v3
with:
AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }}
AWS_SESSION_TOKEN: ${{ env.AWS_SESSION_TOKEN }}
REGION: ${{ env.AWS_REGION }}
FunctionName: ${{ github.event.ref }}-S3EventConfig
Payload: '{"RequestType": "Delete"}'
LogType: Tail
- name: Remove sceptre stacks
run: pipenv run sceptre --debug --var namespace=${{ github.event.ref }} delete develop/namespaced --yes
- name: Remove artifacts
run: pipenv run python src/scripts/manage_artifacts/artifacts.py --remove --namespace ${{ github.event.ref }} --cfn_bucket ${{ vars.CFN_BUCKET }}