feat(gitea_runner): bound the Docker image cache by count and disk usage

An age-based prune does not cap disk use: the cache grows with how often
new image versions are published, and builds on the runner then fail for
lack of space. Keep the newest N image IDs per repository in the weekly
prune, and add an hourly pressure prune that runs the count prune and a
capped builder prune when the Docker root's filesystem passes a
threshold, behind the same job gate. Both are off by default.

Refs #319

Assisted-by: Claude Code
This commit is contained in:
Defame1297 committed 2026-11-23 18:04:50 +00:00
1 parent 8e512416e9
commit f50ecc2945
12 files changed
+552 -9

No files matched your search

+27
View File
@@ -36,6 +36,33 @@
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
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_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).
quiet: true
when: gitea_runner_docker_prune_enabled | bool
- name: Require a count for the pressure prune
ansible.builtin.assert:
that: >-
gitea_runner_docker_prune_disk_threshold_percent | int == 0
or gitea_runner_docker_prune_keep_per_repository | int > 0
fail_msg: >-
gitea_runner_docker_prune_disk_threshold_percent needs gitea_runner_docker_prune_keep_per_repository above 0:
the pressure prune removes images by that count.
quiet: true
when: gitea_runner_docker_prune_enabled | bool
- name: Require the collections requirements file for the molecule tooling
ansible.builtin.assert:
that: