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

+25 -8
View File
@@ -36,19 +36,36 @@
quiet: true
when: gitea_runner_docker_prune_enabled | bool
# The same character set as the weekly schedule; the size takes Docker's own units.
- name: Validate the Docker prune count and pressure settings
- name: Validate the Docker prune count
ansible.builtin.assert:
that: gitea_runner_docker_prune_keep_per_repository | int >= 0
fail_msg: gitea_runner_docker_prune_keep_per_repository must be 0 (off) or more.
quiet: true
when: gitea_runner_docker_prune_enabled | bool
- name: Validate the Docker prune disk threshold
ansible.builtin.assert:
that:
- gitea_runner_docker_prune_keep_per_repository | int >= 0
- gitea_runner_docker_prune_disk_threshold_percent | int >= 0
- gitea_runner_docker_prune_disk_threshold_percent | int <= 99
- gitea_runner_docker_prune_disk_check_schedule is match('^[A-Za-z0-9 :*,./~-]+$')
- gitea_runner_docker_prune_builder_keep_storage is match('^[0-9]+(B|KB|MB|GB|TB)?$')
fail_msg: gitea_runner_docker_prune_disk_threshold_percent must be 0 (off) or 1 to 99.
quiet: true
when: gitea_runner_docker_prune_enabled | bool
# Same character set as the weekly schedule.
- name: Validate the Docker prune disk check schedule
ansible.builtin.assert:
that: gitea_runner_docker_prune_disk_check_schedule is match('^[A-Za-z0-9 :*,./~-]+$')
fail_msg: gitea_runner_docker_prune_disk_check_schedule must be a plain OnCalendar value (no newline or %).
quiet: true
when: gitea_runner_docker_prune_enabled | bool
# A subset of the units Docker accepts for --keep-storage.
- name: Validate the Docker builder keep-storage size
ansible.builtin.assert:
that: gitea_runner_docker_prune_builder_keep_storage is match('^[0-9]+(B|KB|MB|GB|TB)?$')
fail_msg: >-
gitea_runner_docker_prune_keep_per_repository must be 0 or more, gitea_runner_docker_prune_disk_threshold_percent
0 (off) or 1 to 99, gitea_runner_docker_prune_disk_check_schedule a plain OnCalendar value (no newline or %)
and gitea_runner_docker_prune_builder_keep_storage a number with an optional B, KB, MB, GB or TB (e.g. 10GB).
gitea_runner_docker_prune_builder_keep_storage must be a number with an optional B, KB, MB, GB or TB (e.g. 10GB).
quiet: true
when: gitea_runner_docker_prune_enabled | bool