constellation/.github/actions/constellation_destroy/action.yml
Malte Poll 4a8ebfd921 OS images: use "ref", "stream" and "version"
Switch azure default region to west us
Update find-image script to work with new API spec
Add version for every os image build
generate measurements: Use new API paths
CLI: config fetch measurements: Use image short versions to fetch measurements
CLI: allows shortnames to specify image in config
Image build pipeline: Change paths to contain "ref" and "stream"
2022-12-09 13:37:43 +01:00

45 lines
1.4 KiB
YAML

name: Constellation destroy
description: "Destroy a running Constellation cluster."
inputs:
kubeconfig:
description: "The kubeconfig for the cluster."
required: true
runs:
using: "composite"
steps:
- name: Delete persistent volumes
if: inputs.kubeconfig != ''
continue-on-error: true
shell: bash
env:
KUBECONFIG: ${{ inputs.kubeconfig }}
PV_DELETION_TIMEOUT: "120" # 2 minutes timeout for pv deletion
run: |
ELAPSED=0
echo "::group::Wait for PV deletion"
# Scrap namespaces that contain PVCs
for namespace in `kubectl get namespace --no-headers=true -o custom-columns=":metadata.name"`; do
if [[ `kubectl get pvc -n $namespace --no-headers=true -o custom-columns=":metadata.name" | wc -l` -gt 0 ]]; then
kubectl delete namespace $namespace --wait
fi
done
until [[ "$(kubectl get pv -o json | jq '.items | length')" == "0" ]] || [[ $ELAPSED -gt $PV_DELETION_TIMEOUT ]];
do
echo $(kubectl get pv -o json | jq '.items | length') PV remaining..
sleep 1
ELAPSED=$((ELAPSED+1))
done
if [[ $ELAPSED -gt $PV_DELETION_TIMEOUT ]]; then
echo "Timed out waiting for PV deletion.."
exit 1
fi
echo "::endgroup::"
- name: Constellation terminate
run: constellation terminate --yes
shell: bash