Skip to content

Commit 743dd78

Browse files
author
Tom Barnes
committed
use jsonpath instead of awk in cleanup.sh generic delete path - awk approach stopped working reliably for some reason on wercker
1 parent bada0f9 commit 743dd78

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/integration-tests/bash/cleanup.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,17 @@ function genericDelete {
109109
resfile_yes="$TMP_DIR/kinv_filtered_yesnamespace.out.tmp"
110110

111111
# leftover namespaced artifacts
112-
kubectl get $1 --show-labels=true --all-namespaces=true 2>&1 | egrep -e "($3)" | awk '{ print $1 " " $2 }' | sort > $resfile_yes 2>&1
112+
kubectl get $1 \
113+
-o=jsonpath='{range .items[*]}{.metadata.namespace}{" "}{.kind}{"/"}{.metadata.name}{"\n"}{end}' \
114+
--all-namespaces=true 2>&1 \
115+
| egrep -e "($3)" | sort > $resfile_yes 2>&1
113116
artcount_yes="`cat $resfile_yes | wc -l`"
114117

115118
# leftover non-namespaced artifacts
116-
kubectl get $2 --show-labels=true --all-namespaces=true 2>&1 | egrep -e "($3)" | awk '{ print $1 }' | sort > $resfile_no 2>&1
119+
kubectl get $2 \
120+
-o=jsonpath='{range .items[*]}{.kind}{"/"}{.metadata.name}{"\n"}{end}' \
121+
--all-namespaces=true 2>&1 \
122+
| egrep -e "($3)" | sort > $resfile_no 2>&1
117123
artcount_no="`cat $resfile_no | wc -l`"
118124

119125
artcount_total=$((artcount_yes + artcount_no))

0 commit comments

Comments
 (0)