terry-staging #16

Merged
terry merged 96 commits from terry-staging into main 2026-06-05 16:33:12 +00:00
Showing only changes of commit 42b25b9e09 - Show all commits

View File

@@ -15,23 +15,53 @@ jobs:
set +e set +e
echo "=== Disk before cleanup ===" echo "=== Disk before cleanup ==="
df -h df -h
du -sh "$HOME/.cache/act" "$HOME/.npm" "$HOME/actions-runner/_work" 2>/dev/null
# Identify current act workspace (most recently modified dir) and keep it; wipe the rest.
if [ -d "$HOME/.cache/act" ]; then if [ -d "$HOME/.cache/act" ]; then
du -sh "$HOME/.cache/act" 2>/dev/null CURRENT_ACT=$(ls -1dt "$HOME/.cache/act"/*/ 2>/dev/null | head -1 || true)
find "$HOME/.cache/act" -mindepth 1 -maxdepth 1 -type d -mmin +60 -exec rm -rf {} + 2>/dev/null echo "Preserving current act dir: ${CURRENT_ACT:-<none>}"
fi for d in "$HOME/.cache/act"/*/; do
for dir in "$HOME/actions-runner/_work" "$HOME/.cache/setup-node" "$HOME/.npm/_cacache"; do [ -d "$d" ] || continue
if [ -d "$dir" ]; then if [ "$d" != "$CURRENT_ACT" ]; then
find "$dir" -mindepth 1 -maxdepth 2 -mmin +1440 -exec rm -rf {} + 2>/dev/null echo "Removing stale act workspace: $d"
rm -rf "$d"
fi fi
done done
if command -v docker >/dev/null 2>&1; then
docker image prune -af --filter "until=24h" 2>/dev/null
docker container prune -f --filter "until=24h" 2>/dev/null
docker builder prune -af --filter "until=24h" 2>/dev/null
fi fi
find /tmp -mindepth 1 -maxdepth 1 -mmin +120 \
-not -name 'runner*' -not -name 'act*' \ # Wipe npm and setup-node caches (will repopulate from registry via cache: npm)
rm -rf "$HOME/.npm/_cacache" "$HOME/.npm/_logs" 2>/dev/null
rm -rf "$HOME/.cache/setup-node" 2>/dev/null
# Old actions-runner workspaces (>6h)
if [ -d "$HOME/actions-runner/_work" ]; then
find "$HOME/actions-runner/_work" -mindepth 1 -maxdepth 2 -mmin +360 -exec rm -rf {} + 2>/dev/null
fi
# Docker aggressive prune (all dangling + unused, including volumes)
if command -v docker >/dev/null 2>&1; then
docker system prune -af --volumes 2>/dev/null
fi
# apt cache (if runner uses apt)
if command -v apt-get >/dev/null 2>&1; then
sudo apt-get clean 2>/dev/null
fi
if command -v yum >/dev/null 2>&1; then
sudo yum clean all 2>/dev/null
fi
# /tmp leftovers (>30 min) other than active runner state
find /tmp -mindepth 1 -maxdepth 1 -mmin +30 \
-not -name 'runner*' -not -name 'act*' -not -name 'tmp.*' \
-exec rm -rf {} + 2>/dev/null -exec rm -rf {} + 2>/dev/null
# journald logs vacuum to 100M
if command -v journalctl >/dev/null 2>&1; then
sudo journalctl --vacuum-size=100M 2>/dev/null
fi
echo "=== Disk after cleanup ===" echo "=== Disk after cleanup ==="
df -h df -h
exit 0 exit 0