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
32 lines
2.3 KiB
YAML
32 lines
2.3 KiB
YAML
---
|
|
# One refused input: runs the main entry point with that input and asserts that the expected
|
|
# assert, not something else, stopped it. Input: gitea_runner_test_refused (name, vars, expect).
|
|
# Task vars cannot come from a template as a whole, so each input under test is passed with
|
|
# its usual value as the default.
|
|
- name: "Run the role, case {{ gitea_runner_test_refused.name }}"
|
|
block:
|
|
- name: "Include the role, case {{ gitea_runner_test_refused.name }}"
|
|
ansible.builtin.include_role:
|
|
name: mortis.kamino.gitea_runner
|
|
vars:
|
|
gitea_runner_version: "{{ gitea_runner_test_refused.vars.gitea_runner_version | default('6.0.1') }}"
|
|
gitea_runner_registration_scope: "{{ gitea_runner_test_refused.vars.gitea_runner_registration_scope | default('') }}"
|
|
gitea_runner_docker_prune_schedule: "{{ gitea_runner_test_refused.vars.gitea_runner_docker_prune_schedule | default('Sun *-*-* 04:30:00') }}"
|
|
gitea_runner_docker_prune_image_age: "{{ gitea_runner_test_refused.vars.gitea_runner_docker_prune_image_age | default('168h') }}"
|
|
gitea_runner_docker_prune_keep_per_repository: "{{ gitea_runner_test_refused.vars.gitea_runner_docker_prune_keep_per_repository | default(2) }}"
|
|
gitea_runner_docker_prune_disk_threshold_percent: "{{ gitea_runner_test_refused.vars.gitea_runner_docker_prune_disk_threshold_percent | default(90) }}"
|
|
gitea_runner_docker_prune_builder_keep_storage: "{{ gitea_runner_test_refused.vars.gitea_runner_docker_prune_builder_keep_storage | default('10GB') }}"
|
|
gitea_runner_molecule_enabled: "{{ gitea_runner_test_refused.vars.gitea_runner_molecule_enabled | default(false) }}"
|
|
|
|
# Only reached when the include returned. The message must not contain the expected
|
|
# text, so the rescue below cannot mistake it for the assert.
|
|
- name: "Fail because the include returned, case {{ gitea_runner_test_refused.name }}"
|
|
ansible.builtin.fail:
|
|
msg: The role accepted the input
|
|
rescue:
|
|
- name: "The expected assert fired, case {{ gitea_runner_test_refused.name }}"
|
|
ansible.builtin.assert:
|
|
that: gitea_runner_test_refused.expect in ansible_failed_result.msg | default('')
|
|
fail_msg: "Expected '{{ gitea_runner_test_refused.expect }}', got: {{ ansible_failed_result.msg | default('') }}"
|
|
quiet: true
|