-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (80 loc) · 3.02 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: Cleanup
permissions:
id-token: write
on:
workflow_dispatch:
inputs:
stackName:
description: "Name of the stack to clean"
required: true
mqtt_bridge_tag:
description: "MQTT bridge container tag to deploy"
required: true
http_api_mock_stack_name:
description: "Stack name of the HTTP API mock instance"
required: true
env:
CI: 1
FORCE_COLOR: 3
JSII_SILENCE_WARNING_UNTESTED_NODE_VERSION: 1
STACK_NAME: ${{ github.event.inputs.stackName }}
MQTT_BRIDGE_CONTAINER_TAG: ${{ github.event.inputs.mqtt_bridge_tag }}
jobs:
cleanup:
runs-on: ubuntu-24.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "22.x"
cache: "npm"
- name: Install dependencies
run: npm ci --no-audit
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
# The role is set up via https://github.com/hello-nrfcloud/ci
# secrets.AWS_ACCOUNT_ID_CI is an organization secret
role-to-assume: |
arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID_CI }}:role/${{ github.repository_owner }}-ci-${{ github.event.repository.name }}
# vars.AWS_REGION_CI is an organization variable
aws-region: ${{ vars.AWS_REGION_CI }}
- name: Delete logs
run: ./cli.sh logs -X
- name: Destroy stack
run: npx cdk destroy --all -f
- name: Clean up SSM parameters
run: |
./cli.sh fake-nrfcloud-account-device nordic --remove
./cli.sh configure-nrfcloud-account nordic apiEndpoint -X
./cli.sh configure-nrfcloud-account nordic apiKey -X
./cli.sh fake-nrfcloud-account-device elite --remove
./cli.sh configure-nrfcloud-account elite apiEndpoint -X
./cli.sh configure-nrfcloud-account elite apiKey -X
./cli.sh configure-feedback webhookURL -X
./cli.sh clean-backup-certificates
- name: Delete ECR repositories
run: |
aws ecr delete-repository --force --repository-name ${{ env.STACK_NAME }}-mqtt-bridge
cleanup-http-api-mock:
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "22.x"
cache: "npm"
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
# The role is set up via https://github.com/hello-nrfcloud/ci
# secrets.AWS_ACCOUNT_ID_CI is an organization secret
role-to-assume: |
arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID_CI }}:role/${{ github.repository_owner }}-ci-${{ github.event.repository.name }}
# vars.AWS_REGION_CI is an organization variable
aws-region: ${{ vars.AWS_REGION_CI }}
- name: Delete HTTP API mock
run: |
npx @bifravst/http-api-mock destroy ${{ inputs.http_api_mock_stack_name }}