From efda517d93f2d9899a2f79d3371f9bb42c655f7f Mon Sep 17 00:00:00 2001 From: Benjamin Elder Date: Thu, 9 Oct 2025 16:55:36 -0700 Subject: [PATCH] speed up make clean by narrowing recursive chmod --- build/common.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/build/common.sh b/build/common.sh index 1e47c3cda95..cf58de3d187 100755 --- a/build/common.sh +++ b/build/common.sh @@ -391,8 +391,14 @@ function kube::build::clean() { if [[ -d "${LOCAL_OUTPUT_ROOT}" ]]; then kube::log::status "Removing _output directory" - # this ensures we can clean _output/local/go/cache which is not rw by default - chmod -R +w "${LOCAL_OUTPUT_ROOT}" + # This ensures we can clean _output/local/go/cache which is not rw by default. + # + # We only do this path specifically instead of the entire output root + # because recursive chmod is slow. + # We don't need to do this at all for dockerized builds + if [[ -d "${LOCAL_OUTPUT_ROOT}/local/go/cache" ]]; then + chmod -R +w "${LOCAL_OUTPUT_ROOT}/local/go/cache" + fi rm -rf "${LOCAL_OUTPUT_ROOT}" fi }