docker_prune: add new options for cleaning build caches (#845)

* Add new options for cleaning build caches to docker_prune.

* Add tests.
This commit is contained in:
Felix Fontein
2024-05-09 17:12:36 +02:00
committed by GitHub
parent 9beac01ce1
commit f51ca84197
3 changed files with 83 additions and 1 deletions
@@ -126,6 +126,28 @@
debug:
var: result
- name: Prune build cache (API version 1.39+)
when: docker_api_version is version('1.39', '>=')
block:
- name: Prune build cache with option
docker_prune:
builder_cache: true
builder_cache_all: true
builder_cache_filters:
until: 10m
builder_cache_keep_storage: 1MB
register: result
- name: Show results
debug:
var: result
- name: Check results
assert:
that:
- "'builder_cache_space_reclaimed' in result"
- "'builder_cache_caches_deleted' in result"
- name: Prune volumes with all filter (API version 1.42+)
when: docker_api_version is version('1.42', '>=')
block: