daml/ci/clean-up.yml
Gary Verhaegen 2662163a23
cleanup: kill more stuff (#9411)
In this case we had Java and Daml processes running.

May be worth moving this to the reset-caches scripts later on.

changelog_begin
changelog_end
2021-04-14 15:15:03 +02:00

42 lines
1.2 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 -Is) [out]: $line"; done)
exec 2> >(while IFS= read -r line; do echo "$(date -Is) [err]: $line"; done >&2)
# Location of the disk cache for CI servers set in their init files:
# infra/macos/2-common-box/init.sh:echo "build:darwin --disk_cache=~/.bazel-cache" > ~/.bazelrc
# infra/vsts_agent_linux_startup.sh:echo "build:linux --disk_cache=~/.bazel-cache" > ~/.bazelrc
case $(uname) in
Linux)
cache_1=/home/vsts/.cache/bazel
cache_2=/home/vsts/.bazel-cache
;;
Darwin)
cache_1=/var/tmp/_bazel_vsts
cache_2=/Users/vsts/.bazel-cache
;;
esac
for cache in $cache_1 $cache_2; do
for pid in $(lsof $cache | sed 1d | awk '{print $2}' | sort -u); do
kill -s KILL $pid
done
done
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
displayName: clean-up disk cache