destroy #15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |