Skip to content

Commit

Permalink
chore(CI): completely remove unchanged base folders (#782)
Browse files Browse the repository at this point in the history
  • Loading branch information
apeabody authored Dec 16, 2024
1 parent 84070ba commit 82bafc5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion build/int.cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 82bafc5

Please sign in to comment.