mirror of
https://github.com/ansible-collections/community.docker.git
synced 2026-03-16 12:06:29 +00:00
* Move licenses to LICENSES/, use SPDX-License-Identifier, mention all licenses in galaxy.yml. * ignore.txt lines cannot be empty or contain only a comment. * Cleanup. * This particular __init__.py seems to be crucial. * Try extra newline. * Markdown comments are a real mess. I hope this won't break Galaxy... * More licenses. * Add sanity test. * Skip some files, lint. * Make sure there is a copyright line everywhere. * Also check for copyright line in sanity tests. * Remove colon after 'Copyright'. * Normalize lint script. * Avoid colon after 'Copyright' in lint script. * Improve license checker. * Update README.md Co-authored-by: Maxwell G <9920591+gotmax23@users.noreply.github.com> * Remove superfluous space. * Referencing target instead of symlink Co-authored-by: Maxwell G <9920591+gotmax23@users.noreply.github.com>
72 lines
2.1 KiB
YAML
72 lines
2.1 KiB
YAML
---
|
|
# Copyright (c) Ansible Project
|
|
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
####################################################################
|
|
# WARNING: These are designed specifically for Ansible tests #
|
|
# and should not be used as examples of how to write Ansible roles #
|
|
####################################################################
|
|
|
|
- name: Create random names
|
|
set_fact:
|
|
cname: "{{ 'ansible-container-%0x' % ((2**32) | random) }}"
|
|
nname: "{{ 'ansible-network-%0x' % ((2**32) | random) }}"
|
|
vname: "{{ 'ansible-volume-%0x' % ((2**32) | random) }}"
|
|
|
|
- block:
|
|
# Create objects to be pruned
|
|
- docker_container:
|
|
name: "{{ cname }}"
|
|
image: "{{ docker_test_image_hello_world }}"
|
|
state: present
|
|
register: container
|
|
- docker_network:
|
|
name: "{{ nname }}"
|
|
state: present
|
|
register: network
|
|
- docker_volume:
|
|
name: "{{ vname }}"
|
|
state: present
|
|
register: volume
|
|
|
|
# Prune objects
|
|
- docker_prune:
|
|
containers: yes
|
|
images: yes
|
|
networks: yes
|
|
volumes: yes
|
|
builder_cache: yes
|
|
register: result
|
|
|
|
# Analyze result
|
|
- debug: var=result
|
|
- assert:
|
|
that:
|
|
# containers
|
|
- container.container.Id in result.containers
|
|
- "'containers_space_reclaimed' in result"
|
|
# images
|
|
- "'images_space_reclaimed' in result"
|
|
# networks
|
|
- network.network.Name in result.networks
|
|
# volumes
|
|
- volume.volume.Name in result.volumes
|
|
- "'volumes_space_reclaimed' in result"
|
|
# builder_cache
|
|
- "'builder_cache_space_reclaimed' in result"
|
|
|
|
# Test with filters
|
|
- docker_prune:
|
|
images: yes
|
|
images_filters:
|
|
dangling: true
|
|
register: result
|
|
|
|
- debug: var=result
|
|
|
|
when: docker_api_version is version('1.25', '>=')
|
|
|
|
- fail: msg="Too old docker / docker-py version to run docker_prune tests!"
|
|
when: not(docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|