fix(gitea_runner): address review of the prune count and threshold

Give each new input its own assert message so every refused-input case
matches only its own input, and cover a negative count and a bad disk
check schedule. Fire the pressure prune only above the threshold, as
the inputs describe it. Name the disk check script apart from the
pressure service, prefix the new registers as internal, and keep the
new comments short.

Refs #319

Assisted-by: Claude Code
This commit is contained in:
Defame1297 committed 2026-11-23 18:20:32 +00:00
1 parent f50ecc2945
commit e91c074373
10 files changed
+86 -63

No files matched your search

@@ -1,5 +1,5 @@
#!/bin/sh
# Exit 0 when the filesystem holding the Docker root is at least $1 percent full (the pressure
# Exit 0 when the filesystem holding the Docker root is more than $1 percent full (the pressure
# prune may run), 1 to skip. Every failure skips: the prune must not run when the state is unknown.
threshold="$1"
case "$threshold" in
@@ -10,9 +10,9 @@ use=$(df -P "$root" | awk 'NR == 2 { sub(/%$/, "", $5); print $5 }')
case "$use" in
'' | *[!0-9]*) echo "cannot read the use of '$root'"; exit 1 ;;
esac
if [ "$use" -ge "$threshold" ]; then
echo "$root is $use% full, threshold $threshold%: pruning"
if [ "$use" -gt "$threshold" ]; then
echo "$root is $use% full, above $threshold%: pruning"
exit 0
fi
echo "$root is $use% full, below $threshold%: skipping the prune"
echo "$root is $use% full, not above $threshold%: skipping the prune"
exit 1