daml/ci/clean-up.yml
Gary Verhaegen a56cfead28
even earlier mount failure detection (#10371)
CHANGELOG_BEGIN
CHANGELOG_END
2021-07-22 12:36:41 +02:00

58 lines
1.4 KiB
YAML

# Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
steps:
- bash: |
set -euo pipefail
eval "$(dev-env/bin/dade-assist)"
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..."
$HOME/reset_caches.sh
echo "Done."
df -h .
fi
## More temp debugging
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 more debugging
displayName: clean-up disk cache