mirror of
https://github.com/bunkerity/bunkerized-nginx
synced 2023-12-13 21:30:18 +01:00
39 lines
1.1 KiB
YAML
39 lines
1.1 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
|
|
- 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 }}
|