ci: clear the target dir if it gets too big
This commit is contained in:
parent
0ab94551f4
commit
3550110e57
2 changed files with 26 additions and 0 deletions
20
script/clear-target-dir-if-larger-than
Executable file
20
script/clear-target-dir-if-larger-than
Executable file
|
@ -0,0 +1,20 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
if [[ $# < 1 ]]; then
|
||||
echo "usage: $0 <MAX_SIZE_IN_GB>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
max_size_gb=$1
|
||||
|
||||
current_size=$(du -s target | cut -f1)
|
||||
current_size_gb=$(expr ${current_size} / 1024 / 1024)
|
||||
|
||||
echo "target directory size: ${current_size_gb}gb. max size: ${max_size_gb}gb"
|
||||
|
||||
if [[ ${current_size_gb} -gt ${max_size_gb} ]]; then
|
||||
echo "clearing target directory"
|
||||
rm -rf target
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue