1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fix docker CI. (#1494)

Backport of ansible-collections/community.docker#50 to stable-1.
This commit is contained in:
Felix Fontein 2020-12-15 20:20:43 +01:00 committed by GitHub
parent 777a741d4d
commit 6d4760eb20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 54 additions and 58 deletions

View file

@ -11,7 +11,7 @@
name: "{{ image }}"
source: pull
loop:
- "{{ docker_test_image_hello_world }}:latest"
- "{{ docker_test_image_hello_world }}"
- "{{ docker_test_image_alpine }}"
loop_control:
loop_var: image
@ -19,7 +19,7 @@
- name: Get image ID of {{ docker_test_image_hello_world }} and {{ docker_test_image_alpine }} images
docker_image_info:
name:
- "{{ docker_test_image_hello_world }}:latest"
- "{{ docker_test_image_hello_world }}"
- "{{ docker_test_image_alpine }}"
register: image_info
@ -103,25 +103,25 @@
- create_6.container.Image == image_info.images[1].Id
- create_6.container.Id == create_4.container.Id # make sure container wasn't recreated
- name: Create container with {{ docker_test_image_hello_world }} image via old digest
- name: Create container with {{ docker_test_image_digest_base }} image via old digest
docker_container:
image: "{{ docker_test_image_hello_world }}@sha256:{{ docker_test_image_hello_world_digest_v1 }}"
image: "{{ docker_test_image_digest_base }}@sha256:{{ docker_test_image_digest_v1 }}"
name: "{{ cname }}"
state: present
force_kill: yes
register: digest_1
- name: Create container with {{ docker_test_image_hello_world }} image via old digest (idempotent)
- name: Create container with {{ docker_test_image_digest_base }} image via old digest (idempotent)
docker_container:
image: "{{ docker_test_image_hello_world }}@sha256:{{ docker_test_image_hello_world_digest_v1 }}"
image: "{{ docker_test_image_digest_base }}@sha256:{{ docker_test_image_digest_v1 }}"
name: "{{ cname }}"
state: present
force_kill: yes
register: digest_2
- name: Update container with {{ docker_test_image_hello_world }} image via new digest
- name: Update container with {{ docker_test_image_digest_base }} image via new digest
docker_container:
image: "{{ docker_test_image_hello_world }}@sha256:{{ docker_test_image_hello_world_digest_v2 }}"
image: "{{ docker_test_image_digest_base }}@sha256:{{ docker_test_image_digest_v2 }}"
name: "{{ cname }}"
state: present
force_kill: yes

View file

@ -587,12 +587,6 @@
# of hello-world. We don't know why this happens, but it happens
# often enough to be annoying. That's why we disable this for now,
# and simply test that 'Output' is contained in the result.
# NOTE {{ docker_test_image_hello_world }} is no longer necessarily the
# hello-world image, so we potentially have a different output
# anyway. If someone wants to revive this test, it's probably best
# to keep {{ docker_test_image_hello_world }} as some image that
# has 'echo' and execute 'echo "Hello from Docker!"' or something
# like that.
- "'Output' in detach_no_cleanup.container"
# - "'Hello from Docker!' in detach_no_cleanup.container.Output"
- detach_no_cleanup_cleanup is changed

View file

@ -5,14 +5,14 @@
- name: Make sure image is not there
docker_image:
name: "{{ docker_test_image_hello_world }}:latest"
name: "{{ docker_test_image_hello_world }}"
state: absent
force_absent: yes
register: absent_1
- name: Make sure image is not there (idempotency)
docker_image:
name: "{{ docker_test_image_hello_world }}:latest"
name: "{{ docker_test_image_hello_world }}"
state: absent
register: absent_2
@ -22,14 +22,14 @@
- name: Make sure image is there
docker_image:
name: "{{ docker_test_image_hello_world }}:latest"
name: "{{ docker_test_image_hello_world }}"
state: present
source: pull
register: present_1
- name: Make sure image is there (idempotent)
docker_image:
name: "{{ docker_test_image_hello_world }}:latest"
name: "{{ docker_test_image_hello_world }}"
state: present
source: pull
register: present_2
@ -41,28 +41,28 @@
- name: Make sure tag is not there
docker_image:
name: "{{ docker_test_image_hello_world }}:alias"
name: "{{ docker_test_image_hello_world_base }}:alias"
state: absent
- name: Tag image with alias
docker_image:
source: local
name: "{{ docker_test_image_hello_world }}:latest"
repository: "{{ docker_test_image_hello_world }}:alias"
name: "{{ docker_test_image_hello_world }}"
repository: "{{ docker_test_image_hello_world_base }}:alias"
register: tag_1
- name: Tag image with alias (idempotent)
docker_image:
source: local
name: "{{ docker_test_image_hello_world }}:latest"
repository: "{{ docker_test_image_hello_world }}:alias"
name: "{{ docker_test_image_hello_world }}"
repository: "{{ docker_test_image_hello_world_base }}:alias"
register: tag_2
- name: Tag image with alias (force, still idempotent)
docker_image:
source: local
name: "{{ docker_test_image_hello_world }}:latest"
repository: "{{ docker_test_image_hello_world }}:alias"
name: "{{ docker_test_image_hello_world }}"
repository: "{{ docker_test_image_hello_world_base }}:alias"
force_tag: yes
register: tag_3
@ -74,5 +74,5 @@
- name: Cleanup alias tag
docker_image:
name: "{{ docker_test_image_hello_world }}:alias"
name: "{{ docker_test_image_hello_world_base }}:alias"
state: absent

View file

@ -22,31 +22,31 @@
state: absent
force_absent: yes
- name: Make sure we have {{ docker_test_image_hello_world }}:latest
- name: Make sure we have {{ docker_test_image_hello_world }}
docker_image:
name: "{{ docker_test_image_hello_world }}:latest"
name: "{{ docker_test_image_hello_world }}"
source: pull
- name: Push image to test registry
docker_image:
name: "{{ docker_test_image_hello_world }}:latest"
repository: "{{ hello_world_image_base }}"
name: "{{ docker_test_image_hello_world }}"
repository: "{{ hello_world_image_base }}:latest"
push: yes
source: local
register: push_1
- name: Push image to test registry (idempotent)
docker_image:
name: "{{ docker_test_image_hello_world }}:latest"
repository: "{{ hello_world_image_base }}"
name: "{{ docker_test_image_hello_world }}"
repository: "{{ hello_world_image_base }}:latest"
push: yes
source: local
register: push_2
- name: Push image to test registry (force, still idempotent)
docker_image:
name: "{{ docker_test_image_hello_world }}:latest"
repository: "{{ hello_world_image_base }}"
name: "{{ docker_test_image_hello_world }}"
repository: "{{ hello_world_image_base }}:latest"
push: yes
source: local
force_tag: yes

View file

@ -184,27 +184,27 @@
- name: Archive image
docker_image:
name: "{{ docker_test_image_hello_world }}:latest"
name: "{{ docker_test_image_hello_world }}"
archive_path: "{{ output_dir }}/image.tar"
source: pull
register: archive_image
- name: remove image
docker_image:
name: "{{ docker_test_image_hello_world }}:latest"
name: "{{ docker_test_image_hello_world }}"
state: absent
force_absent: yes
- name: load image (changed)
docker_image:
name: "{{ docker_test_image_hello_world }}:latest"
name: "{{ docker_test_image_hello_world }}"
load_path: "{{ output_dir }}/image.tar"
source: load
register: load_image
- name: load image (idempotency)
docker_image:
name: "{{ docker_test_image_hello_world }}:latest"
name: "{{ docker_test_image_hello_world }}"
load_path: "{{ output_dir }}/image.tar"
source: load
register: load_image_1

View file

@ -25,23 +25,23 @@
source: pull
state: present
loop:
- "{{ docker_test_image_hello_world }}:latest"
- "{{ docker_test_image_hello_world }}"
- "{{ docker_test_image_alpine }}"
- name: Inspect an available image
docker_image_info:
name: "{{ docker_test_image_hello_world }}:latest"
name: "{{ docker_test_image_hello_world }}"
register: result
- assert:
that:
- "result.images|length == 1"
- "(docker_test_image_hello_world ~ ':latest') in result.images[0].RepoTags"
- "docker_test_image_hello_world in result.images[0].RepoTags"
- name: Inspect multiple images
docker_image_info:
name:
- "{{ docker_test_image_hello_world }}:latest"
- "{{ docker_test_image_hello_world }}"
- "{{ docker_test_image_alpine }}"
register: result
@ -50,7 +50,7 @@
- assert:
that:
- "result.images|length == 2"
- "(docker_test_image_hello_world ~ ':latest') in result.images[0].RepoTags"
- "docker_test_image_hello_world in result.images[0].RepoTags"
- "docker_test_image_alpine in result.images[1].RepoTags"
when: docker_py_version is version('1.8.0', '>=') and docker_api_version is version('1.20', '>=')

View file

@ -1,5 +1,5 @@
version: '3'
services:
busybox:
image: "{{ docker_test_image_busybox }}:latest"
image: "{{ docker_test_image_busybox }}"
command: sleep 3600

View file

@ -2,7 +2,7 @@ stack_compose_base:
version: '3'
services:
busybox:
image: "{{ docker_test_image_busybox }}:latest"
image: "{{ docker_test_image_busybox }}"
command: sleep 3600
stack_compose_overrides:

View file

@ -1,5 +1,5 @@
version: '3'
services:
busybox:
image: "{{ docker_test_image_busybox }}:latest"
image: "{{ docker_test_image_busybox }}"
command: sleep 3600

View file

@ -2,7 +2,7 @@ stack_compose_base:
version: '3'
services:
busybox:
image: "{{ docker_test_image_busybox }}:latest"
image: "{{ docker_test_image_busybox }}"
command: sleep 3600
stack_compose_overrides:

View file

@ -74,7 +74,7 @@
that:
- 'output.results | type_debug == "list"'
- 'output.results[0].DesiredState == "Running"'
- 'output.results[0].Image == docker_test_image_busybox ~ ":latest"'
- 'output.results[0].Image == docker_test_image_busybox'
- 'output.results[0].Name == "test_stack_busybox.1"'
always:

View file

@ -1,5 +1,5 @@
version: '3'
services:
busybox:
image: "{{ docker_test_image_busybox }}:latest"
image: "{{ docker_test_image_busybox }}"
command: sleep 3600

View file

@ -2,7 +2,7 @@ stack_compose_base:
version: '3'
services:
busybox:
image: "{{ docker_test_image_busybox }}:latest"
image: "{{ docker_test_image_busybox }}"
command: sleep 3600
stack_compose_overrides:

View file

@ -47,4 +47,4 @@
- name: run a Docker container on the target Docker Machine host to verify that Docker daemon connection settings from the docker-machine inventory plugin work as expected
docker_container:
name: test
image: hello-world:latest
image: hello-world:latest

View file

@ -1,9 +1,11 @@
---
docker_test_image_hello_world_digest_v1: e004c2cc521c95383aebb1fb5893719aa7a8eae2e7a71f316a4410784edb00a9
docker_test_image_hello_world_digest_v2: c9249fdf56138f0d929e2080ae98ee9cb2946f71498fc1484288e6a935b5e5bc
docker_test_image_hello_world: quay.io/app-sre/busybox
docker_test_image_busybox: quay.io/app-sre/busybox
docker_test_image_alpine: quay.io/app-sre/alpine:3.8
docker_test_image_alpine_different: quay.io/app-sre/alpine:3.7
docker_test_image_registry_nginx: nginx:alpine
docker_test_image_digest_v1: e004c2cc521c95383aebb1fb5893719aa7a8eae2e7a71f316a4410784edb00a9
docker_test_image_digest_v2: ee44b399df993016003bf5466bd3eeb221305e9d0fa831606bc7902d149c775b
docker_test_image_digest_base: quay.io/ansible/docker-test-containers
docker_test_image_hello_world: quay.io/ansible/docker-test-containers:hello-world
docker_test_image_hello_world_base: quay.io/ansible/docker-test-containers
docker_test_image_busybox: quay.io/ansible/docker-test-containers:busybox
docker_test_image_alpine: quay.io/ansible/docker-test-containers:alpine3.8
docker_test_image_alpine_different: quay.io/ansible/docker-test-containers:alpine3.7
docker_test_image_registry_nginx: quay.io/ansible/docker-test-containers:nginx-alpine
docker_test_image_registry: registry:2.6.1