From 82bafc505a4869582e27a5ae7a28c2164d790e40 Mon Sep 17 00:00:00 2001 From: Andrew Peabody Date: Sun, 15 Dec 2024 17:44:33 -0800 Subject: [PATCH] chore(CI): completely remove unchanged base folders (#782) --- build/int.cloudbuild.yaml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/build/int.cloudbuild.yaml b/build/int.cloudbuild.yaml index 0ed1123b6..1d5748df1 100644 --- a/build/int.cloudbuild.yaml +++ b/build/int.cloudbuild.yaml @@ -42,9 +42,16 @@ steps: fi done < _changed_folders + # Remove base folders without changes + for d in *; do + if ! grep -q "^$d$" _changed_folders && [[ "$d" != "test" ]]; then + rm -rf $d; + fi + done + # Remove leaf folders without changes or non-tf resources for d in `find . -type d -name 'test' -prune -o -links 2 -printf '%P\n'`; do - if ! grep -q "^$d" _changed_folders && ! [ -n "$(find $d -maxdepth 1 -not -name '*.tf' -type f -print -quit)" ]; then + if ! grep -q "^$d" _changed_folders && ! [ -n "$(find $d -maxdepth 1 -not -name '*.tf' -and -not -name 'test.yaml' -type f -print -quit)" ]; then rm -rf $d fi done