Skip to content

Commit 82bafc5

Browse files
authored
chore(CI): completely remove unchanged base folders (terraform-google-modules#782)
1 parent 84070ba commit 82bafc5

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

build/int.cloudbuild.yaml

+8-1
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,16 @@ steps:
4242
fi
4343
done < _changed_folders
4444
45+
# Remove base folders without changes
46+
for d in *; do
47+
if ! grep -q "^$d$" _changed_folders && [[ "$d" != "test" ]]; then
48+
rm -rf $d;
49+
fi
50+
done
51+
4552
# Remove leaf folders without changes or non-tf resources
4653
for d in `find . -type d -name 'test' -prune -o -links 2 -printf '%P\n'`; do
47-
if ! grep -q "^$d" _changed_folders && ! [ -n "$(find $d -maxdepth 1 -not -name '*.tf' -type f -print -quit)" ]; then
54+
if ! grep -q "^$d" _changed_folders && ! [ -n "$(find $d -maxdepth 1 -not -name '*.tf' -and -not -name 'test.yaml' -type f -print -quit)" ]; then
4855
rm -rf $d
4956
fi
5057
done

0 commit comments

Comments
 (0)