openstack-helm-images/zuul.d/playbooks/publish.yml

26 lines
1.2 KiB
YAML

---
- hosts: all[0]
tasks:
#TODO(evrardjp): Add quay.io support when we have the appropriate credentials.
#See also: https://review.openstack.org/#/c/624713/7/zuul.d/playbooks/publish.yml
- name: Login to Docker Hub
command: docker login -u {{ openstack_helm_images_publish_credentials.dockerhub_user }} -p {{ openstack_helm_images_publish_credentials.dockerhub_password }}
no_log: True
- name: List unique images of this build, in the format "registry:tag id"
shell: docker images | awk '/openstackhelm/ {print $1 ":" $2 " " $3}' | uniq -f 1
changed_when: false
register: detailed_image_list
- name: Show found images
debug:
var: detailed_image_list.stdout_lines
- name: Tag all images for publication to DockerHub
shell: "docker tag {{ item.split(' ')[1] }} {{ item.split(' ')[0] | regex_replace('^.*openstackhelm/(.*)$', 'openstackhelm/\\1') }}"
loop: "{{ detailed_image_list.stdout_lines }}"
- name: Push images to Docker Hub
command: "docker push {{ item.split(' ')[0] | regex_replace('^.*openstackhelm/(.*)$', 'openstackhelm/\\1') }}"
loop: "{{ detailed_image_list.stdout_lines }}"