-
Notifications
You must be signed in to change notification settings - Fork 90
106 lines (101 loc) · 3.27 KB
/
e2e-workspace-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
99
100
101
102
103
104
105
106
name: e2e-workspace-cleanup
on:
workflow_call:
inputs:
workspace:
type: string
description: Terraform workspace to turn down
required: true
secrets:
E2E_TESTIM_AWS_ACCESS_KEY_ID:
required: true
E2E_TESTIM_AWS_SECRET_ACCESS_KEY:
required: true
E2E_GH_PAT:
required: true
repository_dispatch:
types:
- e2e-workspace-cleanup
workflow_dispatch:
inputs:
workspace:
type: string
description: Terraform workspace to turn down
required: true
concurrency: cleanup-${{ github.event.inputs.workspace || github.event.client_payload.workspace }}
env:
AWS_DEFAULT_REGION: us-east-1
AWS_ACCESS_KEY_ID: ${{ secrets.E2E_TESTIM_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.E2E_TESTIM_AWS_SECRET_ACCESS_KEY }}
TF_WORKSPACE: ${{ github.event.inputs.workspace || github.event.client_payload.workspace }}
TF_VAR_testim_token: NO_TOKEN
jobs:
cleanup-workspace:
runs-on: ubuntu-latest
defaults:
run:
working-directory: automation/cluster
strategy:
fail-fast: false
matrix:
environment:
- embedded-airgapped-install
- embedded-airgapped-upgrade
- embedded-online-install
- embedded-online-upgrade
- existing-airgapped-install-admin
- existing-airgapped-install-minimum
- existing-airgapped-upgrade-admin
- existing-airgapped-upgrade-minimum
- existing-online-install-admin
- existing-online-install-minimum
- existing-online-upgrade-admin
- existing-online-upgrade-minimum
- helmvm-online-install
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: replicatedhq/kots-regression-automation
token: ${{ secrets.E2E_GH_PAT }}
path: automation
ref: main
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
- name: Initialize Terraform
env:
TF_WORKSPACE: default
run: terraform init -reconfigure -backend-config=${{ matrix.environment }}-backend-config.tfvars
- name: Destroy infrastructure
run: ./${{ matrix.environment }}.sh destroy
- name: Delete workspace
env:
TF_WORKSPACE: default
run: terraform workspace delete ${{ github.event.inputs.workspace || github.event.client_payload.workspace }}
cleanup-jumpbox:
needs: cleanup-workspace
runs-on: ubuntu-latest
if: always()
defaults:
run:
working-directory: automation/jumpbox
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: replicatedhq/kots-regression-automation
token: ${{ secrets.E2E_GH_PAT }}
path: automation
ref: main
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
- name: Initialize Terraform
env:
TF_WORKSPACE: default
run: terraform init -reconfigure
- name: Destroy infrastructure
run: terraform destroy -auto-approve
- name: Delete workspace
env:
TF_WORKSPACE: default
run: terraform workspace delete ${{ github.event.inputs.workspace || github.event.client_payload.workspace }}