machine_setup/ansible/roles/kubernetes/files/k8s_delete_pipeline_runs
2024-04-06 11:29:38 -04:00

8 lines
388 B
Bash

#!/usr/bin/env bash
#
set -euo pipefail
IFS=$'\n\t'
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
kubectl get pipelinerun --all-namespaces -o go-template='{{range .items}}{{.metadata.namespace}}/{{.metadata.name}}{{"\n"}}{{end}}' | while read p; do namespace=$(cut -d '/' -f 1 <<<"$p"); name=$(cut -d '/' -f 2 <<<"$p"); kubectl delete pipelinerun -n "$namespace" "$name"; done