ara/tests/zuul_publish_dockerhub.yaml

47 lines
1.8 KiB
YAML

# Copyright (c) 2020 Red Hat, Inc.
#
# This file is part of ARA Records Ansible.
#
# ARA is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ARA is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with ARA. If not, see <http://www.gnu.org/licenses/>.
- name: Publish container images to DockerHub
hosts: all
gather_facts: yes
vars:
destination: docker.io/recordsansible/ara-api
images:
# These images are meant to be provided by the "with_container_images.yaml" playbook
- name: localhost/ara-api
tag: distribution-latest
- name: localhost/ara-api
tag: pypi-latest
- name: localhost/ara-api
tag: source-latest
tasks:
- name: Tag images with buildah
command: buildah tag {{ item.name }}:{{ item:tag }} {{ destination }}:{{ item:tag }}
loop: "{{ images }}"
- name: Tag latest from source-latest
command: buildah tag {{ destination }}:source-latest {{ destination }}:latest
- name: Push latest
command: buildah push --creds {{ ara_dockerhub_credentials.username }}:{{ ara_dockerhub_credentials.password }} {{ destination }}:latest
no_log: yes
- name: Push the remainder of the tags
command: buildah push --creds {{ ara_dockerhub_credentials.username }}:{{ ara_dockerhub_credentials.password }} {{ destination }}:{{ item.tag }}
no_log: yes
loop: "{{ images }}"