mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-02 22:39:09 -07: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:
parent
853f65059a
commit
13ab9a61a8
3 changed files with 53 additions and 0 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue