-
Notifications
You must be signed in to change notification settings - Fork 1
56 lines (54 loc) · 1.88 KB
/
destroy.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
53
54
55
56
name: destroy
# Controls when the workflow will run
on:
workflow_dispatch:
inputs:
environment:
description: 'Name of the cluster/environment to destroy'
required: true
default: 'dev'
uninstall_apps:
description: 'Uninstall the applications before destroying the cluster'
type: choice
options:
- "true"
- "false"
required: true
default: "true"
remove_backups:
description: 'Remove all home dir and DB backups from the bucket to get a clean system on the next start'
type: choice
options:
- ""
- "true"
- "false"
required: true
push:
branches:
- 'main'
tags:
- '*.*.*'
jobs:
destroy:
runs-on: ubuntu-latest
env:
GOOGLE_CODER_AUTOMATION: ${{ secrets.GOOGLE_CODER_AUTOMATION }}
GOOGLE_CODER_DNS: ${{ secrets.GOOGLE_CODER_DNS }}
GOOGLE_CODER_STORAGE: ${{ secrets.GOOGLE_CODER_STORAGE }}
GCLOUD_PROJECT: ${{ secrets.GCLOUD_PROJECT }}
CLUSTER_NAME: ${{ github.event.inputs.environment }}
UNINSTALL_APPS: ${{ github.event.inputs.uninstall_apps }}
REMOVE_BACKUPS: ${{ github.event.inputs.remove_backups }}
environment:
name: ${{ github.event.inputs.environment }}
steps:
- name: credentials
run: >
mkdir -p config &&
echo ${GOOGLE_CODER_AUTOMATION} > config/google-coder-automation.json &&
echo ${GOOGLE_CODER_DNS} > config/google-coder-dns.json &&
echo ${GOOGLE_CODER_STORAGE} > config/google-coder-storage.json
shell: bash
- name: run
run: "docker run -v $(pwd)/config:/app/config -e TERRAFORM_OPTIONS=-auto-approve --entrypoint /app/run_destroy.sh isi006/coder-development-cluster:latest ${GCLOUD_PROJECT} ${CLUSTER_NAME} ${UNINSTALL_APPS} ${REMOVE_BACKUPS}"
shell: bash