mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 22:02:50 +00:00
[docker_image] fix the changed state for tagging and pushing (#53451)
* [docker_image] fix the changed state for tagging and pushing Signed-off-by: Jakob Ackermann <das7pad@outlook.com> * [docker_image] add tests for (force) tagging and force pushing Signed-off-by: Jakob Ackermann <das7pad@outlook.com> * [docker_image] add a news fragment for the fixed force tag/push behavior Signed-off-by: Jakob Ackermann <das7pad@outlook.com>
This commit is contained in:
committed by
John R Barker
parent
853f65059a
commit
13ab9a61a8
@@ -38,6 +38,41 @@
|
||||
- present_1 is changed
|
||||
- present_2 is not changed
|
||||
|
||||
- name: Make sure tag is not there
|
||||
docker_image:
|
||||
name: "hello-world:alias"
|
||||
state: absent
|
||||
|
||||
- name: Tag image with alias
|
||||
docker_image:
|
||||
name: "hello-world:latest"
|
||||
repository: "hello-world:alias"
|
||||
register: tag_1
|
||||
|
||||
- name: Tag image with alias (idempotent)
|
||||
docker_image:
|
||||
name: "hello-world:latest"
|
||||
repository: "hello-world:alias"
|
||||
register: tag_2
|
||||
|
||||
- name: Tag image with alias (force, still idempotent)
|
||||
docker_image:
|
||||
name: "hello-world:latest"
|
||||
repository: "hello-world:alias"
|
||||
force: yes
|
||||
register: tag_3
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- tag_1 is changed
|
||||
- tag_2 is not changed
|
||||
- tag_3 is not changed
|
||||
|
||||
- name: Cleanup alias tag
|
||||
docker_image:
|
||||
name: "hello-world:alias"
|
||||
state: absent
|
||||
|
||||
####################################################################
|
||||
## interact with test registry #####################################
|
||||
####################################################################
|
||||
@@ -61,10 +96,19 @@
|
||||
push: yes
|
||||
register: push_2
|
||||
|
||||
- name: Push image to test registry (force, still idempotent)
|
||||
docker_image:
|
||||
name: "hello-world:latest"
|
||||
repository: "{{ registry_address }}/test/hello-world"
|
||||
push: yes
|
||||
force: yes
|
||||
register: push_3
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- push_1 is changed
|
||||
- push_2 is not changed
|
||||
- push_3 is not changed
|
||||
|
||||
- name: Get facts of local image
|
||||
docker_image_facts:
|
||||
|
||||
Reference in New Issue
Block a user