1
0
Fork 0
mirror of https://github.com/containers/ansible-podman-collections.git synced 2026-02-04 07:11:49 +00:00

Fix idempotency for tagging local images (#980)

Signed-off-by: Jeoffrey Bakker <jeoffreybakker@users.noreply.github.com>
This commit is contained in:
Jeoffrey Bakker 2025-09-18 13:59:31 +02:00 committed by GitHub
parent 991e461ea5
commit 0d44070261
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 104 additions and 5 deletions

View file

@ -13,6 +13,22 @@
target_names:
- openjdk8
- jdk8
register: tag_result
- name: Tag image again to test idempotency
containers.podman.podman_tag:
executable: "{{ test_executable | default('podman') }}"
image: docker.io/library/alpine
target_names:
- openjdk8
- jdk8
register: tag_result_idempotency
- name: Check idempotency
assert:
that:
- tag_result.changed == true
- tag_result_idempotency.changed == false
- name: Get tagged image info
containers.podman.podman_image_info:

View file

@ -0,0 +1,22 @@
from __future__ import absolute_import, division, print_function
__metaclass__ = type
import pytest
from ansible_collections.containers.podman.plugins.modules.podman_tag import create_full_qualified_image_name
@pytest.mark.parametrize(
"test_input, expected",
[
("alpine", "localhost/alpine:latest"),
("alpine:3.19", "localhost/alpine:3.19"),
("docker.io/library/alpine", "docker.io/library/alpine:latest"),
("docker.io/alpine", "docker.io/library/alpine:latest"),
("docker.io/alpine@sha256:1234567890abcdef", "docker.io/library/alpine@sha256:1234567890abcdef"),
],
)
def test_create_full_qualified_image_name(test_input, expected):
print(create_full_qualified_image_name.__code__.co_filename)
assert create_full_qualified_image_name(test_input) == expected