bunkerized-nginx/.github/workflows/staging-delete-infra.yml
2023-06-26 13:01:02 -04:00

41 lines
1.2 KiB
YAML

name: Delete staging infra (REUSABLE)
on:
workflow_call:
inputs:
TYPE:
required: true
type: string
secrets:
CICD_SECRETS:
required: true
jobs:
delete:
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
# Prepare
- name: Checkout source code
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install terraform
uses: hashicorp/setup-terraform@v2
- uses: actions/download-artifact@v3
with:
name: tf-${{ inputs.TYPE }}
path: /tmp
- run: tar xvf /tmp/terraform.tar -C / && mkdir ~/.ssh && touch ~/.ssh/id_rsa.pub
- uses: azure/setup-kubectl@v3
if: inputs.TYPE == 'k8s'
# Remove infra
- run: kubectl delete daemonsets,replicasets,services,deployments,pods,rc,ingress,statefulsets --all --all-namespaces --timeout=60s ; kubectl delete pvc --all --timeout=60s ; kubectl delete pv --all --timeout=60s
if: inputs.TYPE == 'k8s'
continue-on-error: true
env:
KUBECONFIG: /tmp/k8s/kubeconfig
- run: ./tests/rm.sh ${{ inputs.TYPE }}
env:
CICD_SECRETS: ${{ secrets.CICD_SECRETS }}