File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -223,6 +223,28 @@ tasks:
223223 - setup-kubeconfig
224224 - cluster-ports-expose
225225
226+ helm-uninstall :
227+ desc : Uninstall all charts using helm uninstall
228+ silent : false
229+ cmds :
230+ - echo "Uninstalling all charts via helm"
231+ - |
232+ # Get cluster ID
233+ CLUSTER_ID=$(replicated cluster ls --output json | jq -r '.[] | select(.name == "{{.CLUSTER_NAME}}") | .id')
234+ if [ -z "$CLUSTER_ID" ]; then
235+ echo "Error: Could not find cluster with name {{.CLUSTER_NAME}}"
236+ exit 1
237+ fi
238+
239+ # Get the list of installed releases and uninstall them
240+ KUBECONFIG={{.KUBECONFIG_FILE}} helm list --all-namespaces -o json | jq -r '.[] | .name + " -n " + .namespace' | while read release; do
241+ echo "Uninstalling helm release: $release"
242+ KUBECONFIG={{.KUBECONFIG_FILE}} helm uninstall $release
243+ done
244+ - echo "All charts uninstalled!"
245+ deps :
246+ - setup-kubeconfig
247+
226248 cluster-delete :
227249 desc : Delete all test clusters with matching name and clean up kubeconfig
228250 silent : false
You can’t perform that action at this time.
0 commit comments