detect mount issue earlier (#10313)

When machine disks are full, we can't clean the Bazel cache if it
happens to not be a mount point. I don't quite understand yet why it's
not a mount point, but maybe I'll be able to investigate more if we catch
the issue early, rather than waiting for the disk to be full and the
clean-up to fail.

CHANGELOG_BEGIN
CHANGELOG_END
This commit is contained in:
Gary Verhaegen 2021-07-19 15:45:50 +02:00 committed by GitHub
parent 0e09f3ba08
commit 3c0010b38a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,6 +10,33 @@ steps:
exec 1> >(while IFS= read -r line; do echo "$(date -uIs) [out]: $line"; done)
exec 2> >(while IFS= read -r line; do echo "$(date -uIs) [err]: $line"; done >&2)
## START temp debug
UNAME=$(uname)
case "$UNAME" in
Darwin)
MPS="/var/tmp/_bazel_vsts /Users/vsts/.bazel-cache"
CMD="hdiutil info"
;;
Linux)
MPS="/home/vsts/.cache/bazel /home/vsts/.bazel-cache"
CMD="mount"
;;
*)
echo "Unexpected uname: $UNAME"
MPS=
;;
esac
for path in $MPS; do
if ! ($CMD | grep -F "$path"); then
echo "$path is not a mount point, aborting"
echo "Please ping @gary on Slack."
exit 1
fi
done
## END temp debug
df -h .
if [ $(df -m . | sed 1d | awk '{print $4}') -lt 50000 ]; then
echo "Disk full, cleaning up..."