diff --git a/hack/make-rules/clean.sh b/hack/make-rules/clean.sh index f2b683ba028..cd5ccb40004 100755 --- a/hack/make-rules/clean.sh +++ b/hack/make-rules/clean.sh @@ -24,15 +24,14 @@ source "${KUBE_ROOT}/hack/lib/util.sh" CLEAN_PATTERNS=( "_tmp" "doc_tmp" - "((?!staging\/src\/k8s\.io\/apiextensions-apiserver\/pkg\/generated\/openapi).)*/zz_generated.openapi.go" "test/e2e/generated/bindata.go" ) -for pattern in "${CLEAN_PATTERNS[@]}"; do - while IFS=$'\n' read -r match; do - echo "Removing ${match#"${KUBE_ROOT}"\/} .." - rm -rf "${match#"${KUBE_ROOT}"\/}" - done < <(find "${KUBE_ROOT}" -iregex "^${KUBE_ROOT}/${pattern}$") +for item in "${CLEAN_PATTERNS[@]}"; do + # Shellcheck wants the ":?" because of paranoia about 'rm -rf /'. It will + # cause an error if unset, which is already true because of "nounset", but + # belts AND suspenders is fine for this. + rm -rf "${KUBE_ROOT:?}/${item:?}" done # ex: ts=2 sw=2 et filetype=sh