Introduce arch aware tag for container images

We will soon be pushing ppc64le container images to
registry.rdoproject.org and need to tag images uniquely from
the x86_64 versions. This patch adds a suffix of the format
'_{{ansible_architecture}}' to the tag of the images. To ensure
backwards compatibility, x86_64 will also use the current tag
of format {{ version_hash }}. The retagging ansible scripts
are modified from an older patchset [0]. Upon promotion, the
suffix should be removed from the tag, a manifest should be
created, and the images should be uploaded to dockerhub.

[0] https://review.opendev.org/#/c/660665/

Depends-On: https://review.opendev.org/678907

Co-Authored-By: Rafael Folco <rfolco@redhat.com>

Change-Id: I537f577c8946ffeeed989a7c686ff85fef96a3f7
This commit is contained in:
Michael Turek 2019-06-07 15:07:00 +00:00 committed by Rafael Folco
parent fdca21dda0
commit 31aac30d5f
4 changed files with 34 additions and 2 deletions

View File

@ -14,3 +14,4 @@ use_buildah: false
buildcontainers_override_repos: ""
buildcontainers_rpm_setup_config: "http://172.17.0.1/delorean.repo,http://172.17.0.1/delorean-{{ ci_branch }}-testing.repo"
openstack_repo_name: delorean
container_cli_opt: ""

View File

@ -31,9 +31,11 @@
cat /etc/yum.repos.d/{{ openstack_repo_name }}.repo |awk -F= '/baseurl/ {print $2}'
register: baseurl
- name: Set version_hash fact
- name: Set version_hash and arch_tag facts
set_fact:
version_hash: "{{ baseurl.stdout.split('/')[-1] }}"
# NOTE(mjturek): Push old style tag for x86_64 first to maintain compatibility.
arch_tag: "{{ '_' + ansible_architecture if ansible_architecture != 'x86_64' else ''}}"
- name: grab kolla patch f28
when: ansible_pkg_mgr == "dnf" and ansible_distribution|lower == "fedora"
@ -177,3 +179,22 @@
when:
- ansible_distribution|lower == "redhat"
- name: Retrieve list of built x86_64 images, retag, and push
when:
- ansible_architecture == "x86_64"
- push_containers | bool
block:
- name: Retrieve built images
command: "awk '{ print $1 }' {{ workspace }}/containers-successfully-built.log"
register: built_images
- name: Disable HTTPS and certificates to access registry (buildah)
set_fact:
container_cli_opt: '--tls-verify=false'
when: use_buildah | bool
- name: Tag images
vars:
image: "{{ item }}"
include: tag.yaml
static: no
with_items: "{{ built_images.stdout_lines }}"
become: true

View File

@ -0,0 +1,10 @@
---
# Tag and push in the same task for the sake of doing less tasks
- name: "Tag w/ arch suffix and push image: {{ image }}"
command: >
{{ cmd }}
with_items:
- "{{ container_cli }} tag {{ image }}:{{ version_hash }} {{ image }}:{{ version_hash }}_{{ ansible_architecture }}"
- "{{ container_cli }} push {{ container_cli_opt }} {{ image }}:{{ version_hash }}_{{ ansible_architecture }}"
loop_control:
loop_var: "cmd"

View File

@ -6,7 +6,7 @@ base_tag={{ kolla_base_tag }}
{% endif %}
type=binary
registry={{ push_registry }}
tag={{ version_hash }}
tag={{ version_hash }}{{ arch_tag }}
template_override={{ openstack_git_root }}/tripleo-common/container-images/tripleo_kolla_template_overrides.j2
# we use the repos off the main host as they will already have the correct mirror info in them
rpm_setup_config="{{ buildcontainers_rpm_setup_config }}"