From 3ad0c1212978fba797c79cf1017c293a8839b7be Mon Sep 17 00:00:00 2001 From: MichaƂ Nasiadka Date: Wed, 18 Nov 2020 10:53:46 +0100 Subject: CI: Improve publish playbook Currently we use a for loop in shell that performs push of images to Docker Hub - that doesn't really seem to fail properly on push errors (e.g. related to new Docker Hub limits). This change introduces usage of Ansible docker_* modules for doing the same job and improves logging (so it's easier to find out which image failed to publish). Change-Id: I083ce70772edd1abb873ad43f6beb73aae01383f --- tests/playbooks/publish.yml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/playbooks/publish.yml b/tests/playbooks/publish.yml index 9a019fac9..212d572ea 100644 --- a/tests/playbooks/publish.yml +++ b/tests/playbooks/publish.yml @@ -1,8 +1,20 @@ --- - hosts: all tasks: + - name: List all containers + docker_host_info: + images: yes + images_filters: + reference: "kolla/*" + register: docker_host_info + - name: Login to Dockerhub - command: "docker login -u {{ kolla_dockerhub_creds.user }} -p {{ kolla_dockerhub_creds.password }}" - no_log: true + docker_login: + username: "{{ kolla_dockerhub_creds.user }}" + password: "{{ kolla_dockerhub_creds.password }}" - - shell: "for img in $(docker images --format '{% raw %}{{ .Repository }}:{{ .Tag }}{% endraw %}' | grep kolla ); do docker push $img; done" + - name: Push built container images + docker_image: + name: "{{ item.RepoTags.0 }}" + push: yes + loop: "{{ docker_host_info.images }}" -- cgit v1.2.3