charts/tools/utils/tekton-cleanup.sh
Tin Lam 4be9dfda68 chore(tests): refactors test script
This patch set refactors and cleans up the test for the cicd stack, and
updates deprecated apiVersion.

Signed-off-by: Tin Lam <tin@irrational.io>
Change-Id: Ice3e678a677ecd4bc39e1fb840d49b3c93453452
2020-12-21 10:08:36 -06:00

24 lines
695 B
Bash
Executable File

#!/bin/bash
set -ex
: ${TEKTON_NS:="tekton-pipelines"}
tekton_releases=$(helm -n $TEKTON_NS ls -q)
if [ -z "$tekton_releases" ]; then
echo "no release in $TEKTON_NS found"
else
for release in $tekton_releases; do
helm -n $TEKTON_NS uninstall $release
done
# waits til the resources are cleaned up
sleep 30
# helm uninstalls should clean up all the resources, but in the scenarios they are orphaned,
# this should attempt to clean it up.
for resource in mutatingwebhookconfigurations validatingwebhookconfigurations; do
kubectl -n $TEKTON_NS get $resource -o name | awk -F'/' '{print $2}' | grep tekton.dev | xargs -r kubectl -n $TEKTON_NS delete $resource
done
fi