Skip to content

Commit

Permalink
openstack-* containers in containers-promote role
Browse files Browse the repository at this point in the history
Switch to the new naming prefix openstack-* for master/victoria
and onwards in containers-promote role. Change stage containers
and molecule tests that are affected by this change. New test
scenarios to be added in follow-up changes to cover different
releases vs build methods (tripleo vs kolla).

Change-Id: I86df791288a48f947fe35849330ae9f428bae106
  • Loading branch information
rafaelfolco authored and Zuul CI committed Aug 28, 2020
1 parent 5cce987 commit 2dad521
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,9 @@ base_container_images: >-
{%- else -%}
{{ base_containers_newworkflow }}
{%- endif -%}
container_name_prefix: >-
{% if release in ['queens','rocky','stein','train','ussuri'] -%}
{{ ansible_distribution|lower }}-binary }}
{%- else -%}
openstack
{%- endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
- block:
- name: 'Production - Pull {{ ppc_pull_attempts }} random {{ ppc_tag }} tagged container images from {{ source_registry.host }} registry'
docker_image:
name: "{{ source_registry.host }}/{{ source_registry.namespace }}/{{ distro_name }}-binary-{{ built_images.stdout_lines|random }}"
name: "{{ source_registry.host }}/{{ source_registry.namespace }}/{{ container_name_prefix }}-{{ built_images.stdout_lines|random }}"
tag: "{{ full_hash }}_{{ ppc_tag }}"
source: pull
loop: "{{ range(0, ppc_pull_attempts)|list }}"
Expand All @@ -38,7 +38,7 @@
# For testing we want to avoid the use of random in the containers we pull
- name: 'Testing - Pull first {{ ppc_pull_attempts }} {{ ppc_tag }} tagged container images from {{ source_registry.host }} registry'
docker_image:
name: "{{ source_registry.host }}/{{ source_registry.namespace }}/{{ distro_name }}-binary-{{ built_images.stdout_lines[index] }}"
name: "{{ source_registry.host }}/{{ source_registry.namespace }}/{{ container_name_prefix }}-{{ built_images.stdout_lines[index] }}"
tag: "{{ full_hash }}_{{ ppc_tag }}"
source: pull
loop: "{{ range(0, ([stage_info.containers.images|length, ppc_pull_attempts]|min))|list }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@

- name: Generate list of containers to push # noqa 306
shell: |
echo -n "Checking {{ source_registry.host }}/{{ source_registry.namespace }}/{{ distro_name }}-binary-{{ item }}:{{ full_hash }} ... ";
echo -n "Checking {{ source_registry.host }}/{{ source_registry.namespace }}/{{ container_name_prefix }}-{{ item }}:{{ full_hash }} ... ";
docker manifest inspect \
--insecure "{{ source_registry.host }}/{{ source_registry.namespace }}/{{ distro_name }}-binary-{{ item }}:{{ full_hash }}"
--insecure "{{ source_registry.host }}/{{ source_registry.namespace }}/{{ container_name_prefix }}-{{ item }}:{{ full_hash }}"
if [[ "$?" == "0" ]]; then
echo {{ item }} >> {{ containers_file }};
echo "OK";
else
echo "FAIL";
echo "ERROR ========== {{ distro_name }}-binary-{{ item }} does not exists on registry, Please check the latest tripleo-ci-testing hash! ==========";
echo "ERROR ========== {{ container_name_prefix }}-{{ item }} does not exists on registry, Please check the latest tripleo-ci-testing hash! ==========";
exit 1
fi
loop: "{{ containers_list }}"
Expand Down Expand Up @@ -98,7 +98,7 @@

- name: Pull the images from source registry
docker_image:
name: "{{ source_registry.host }}/{{ source_registry.namespace }}/{{ distro_name }}-binary-{{ item }}"
name: "{{ source_registry.host }}/{{ source_registry.namespace }}/{{ container_name_prefix }}-{{ item }}"
tag: "{{ full_hash }}"
source: pull
with_items: "{{ built_images.stdout_lines }}"
Expand All @@ -109,15 +109,15 @@
- name: Tag images to source registry with named label
shell: >
docker tag
{{ source_registry.host }}/{{ source_registry.namespace }}/{{ distro_name }}-binary-{{ item }}:{{ full_hash }}
{{ source_registry.host }}/{{ source_registry.namespace }}/{{ distro_name }}-binary-{{ item }}:{{ named_label }}
{{ source_registry.host }}/{{ source_registry.namespace }}/{{ container_name_prefix }}-{{ item }}:{{ full_hash }}
{{ source_registry.host }}/{{ source_registry.namespace }}/{{ container_name_prefix }}-{{ item }}:{{ named_label }}
with_items: "{{ built_images.stdout_lines }}"
tags:
- rdoproject_push

- name: Push images to source registry with named label
shell: >
docker push {{ source_registry.host }}/{{ source_registry.namespace }}/{{ distro_name }}-binary-{{ item }}:{{ named_label }}
docker push {{ source_registry.host }}/{{ source_registry.namespace }}/{{ container_name_prefix }}-{{ item }}:{{ named_label }}
with_items: "{{ built_images.stdout_lines }}"
retries: 3
tags:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
block:
- name: 'Pull any {{ ppc_tag }} tagged container images from {{ source_registry.host }} registry'
docker_image:
name: "{{ source_registry.host }}/{{ source_registry.namespace }}/{{ distro_name }}-binary-{{ item }}"
name: "{{ source_registry.host }}/{{ source_registry.namespace }}/{{ container_name_prefix }}-{{ item }}"
tag: "{{ full_hash }}_{{ ppc_tag }}"
source: pull
loop: "{{ built_images.stdout_lines }}"
Expand All @@ -36,10 +36,10 @@

- name: 'Tag and push {{ ppc_tag }} container images to {{ registry.host }}'
docker_image:
name: "{{ source_registry.host }}/{{ source_registry.namespace }}/{{ distro_name }}-binary-{{ item }}"
name: "{{ source_registry.host }}/{{ source_registry.namespace }}/{{ container_name_prefix }}-{{ item }}"
tag: "{{ full_hash }}_{{ ppc_tag }}"
source: local
repository: "{{ registry.host }}/{{ registry.namespace }}/{{ distro_name }}-binary-{{ item }}"
repository: "{{ registry.host }}/{{ registry.namespace }}/{{ container_name_prefix }}-{{ item }}"
push: yes
retries: 3
loop: "{{ built_images.stdout_lines }}"
Expand All @@ -64,18 +64,18 @@

- name: 'Pull {{ x86_tag }} tagged container images from {{ source_registry.host }}'
docker_image:
name: "{{ source_registry.host }}/{{ source_registry.namespace }}/{{ distro_name }}-binary-{{ item }}"
name: "{{ source_registry.host }}/{{ source_registry.namespace }}/{{ container_name_prefix }}-{{ item }}"
tag: "{{ full_hash }}_{{ x86_tag }}"
source: pull
loop: "{{ built_images.stdout_lines }}"
retries: 3

- name: 'Tag and push {{ x86_tag }} container images to {{ registry.host }}'
docker_image:
name: "{{ source_registry.host }}/{{ source_registry.namespace }}/{{ distro_name }}-binary-{{ item }}"
name: "{{ source_registry.host }}/{{ source_registry.namespace }}/{{ container_name_prefix }}-{{ item }}"
tag: "{{ full_hash }}_{{ x86_tag }}"
source: local
repository: "{{ registry.host }}/{{ registry.namespace }}/{{ distro_name }}-binary-{{ item }}"
repository: "{{ registry.host }}/{{ registry.namespace }}/{{ container_name_prefix }}-{{ item }}"
push: yes
retries: 3
register: pushed_x86
Expand All @@ -96,15 +96,15 @@
- name: 'Create manifests for containers with both {{ x86_tag }} {{ ppc_tag }}'
shell: |
docker manifest create {{ manifest_extra_opts }} \
{{ registry.host }}/{{ registry.namespace }}/{{ distro_name }}-binary-{{ item }}:{{ full_hash }}{{ manifest_tag }} \
{{ registry.host }}/{{ registry.namespace }}/{{ distro_name }}-binary-{{ item }}:{{ full_hash }}_{{ x86_tag }} \
{{ registry.host }}/{{ registry.namespace }}/{{ distro_name }}-binary-{{ item }}:{{ full_hash }}_{{ ppc_tag }}
{{ registry.host }}/{{ registry.namespace }}/{{ container_name_prefix }}-{{ item }}:{{ full_hash }}{{ manifest_tag }} \
{{ registry.host }}/{{ registry.namespace }}/{{ container_name_prefix }}-{{ item }}:{{ full_hash }}_{{ x86_tag }} \
{{ registry.host }}/{{ registry.namespace }}/{{ container_name_prefix }}-{{ item }}:{{ full_hash }}_{{ ppc_tag }}
docker manifest annotate --arch amd64 \
{{ registry.host }}/{{ registry.namespace }}/{{ distro_name }}-binary-{{ item }}:{{ full_hash }}{{ manifest_tag }} \
{{ registry.host }}/{{ registry.namespace }}/{{ distro_name }}-binary-{{ item }}:{{ full_hash }}_{{ x86_tag }}
{{ registry.host }}/{{ registry.namespace }}/{{ container_name_prefix }}-{{ item }}:{{ full_hash }}{{ manifest_tag }} \
{{ registry.host }}/{{ registry.namespace }}/{{ container_name_prefix }}-{{ item }}:{{ full_hash }}_{{ x86_tag }}
docker manifest annotate --arch {{ ppc_tag }} \
{{ registry.host }}/{{ registry.namespace }}/{{ distro_name }}-binary-{{ item }}:{{ full_hash }}{{ manifest_tag }} \
{{ registry.host }}/{{ registry.namespace }}/{{ distro_name }}-binary-{{ item }}:{{ full_hash }}_{{ ppc_tag }}
{{ registry.host }}/{{ registry.namespace }}/{{ container_name_prefix }}-{{ item }}:{{ full_hash }}{{ manifest_tag }} \
{{ registry.host }}/{{ registry.namespace }}/{{ container_name_prefix }}-{{ item }}:{{ full_hash }}_{{ ppc_tag }}
loop_control:
index_var: index
loop: "{{ built_images.stdout_lines }}"
Expand All @@ -116,11 +116,11 @@
- name: 'Create manifests for {{ x86_tag }} only containers'
shell: |
docker manifest create {{ manifest_extra_opts }} \
{{ registry.host }}/{{ registry.namespace }}/{{ distro_name }}-binary-{{ item }}:{{ full_hash }}{{ manifest_tag }} \
{{ registry.host }}/{{ registry.namespace }}/{{ distro_name }}-binary-{{ item }}:{{ full_hash }}_{{ x86_tag }}
{{ registry.host }}/{{ registry.namespace }}/{{ container_name_prefix }}-{{ item }}:{{ full_hash }}{{ manifest_tag }} \
{{ registry.host }}/{{ registry.namespace }}/{{ container_name_prefix }}-{{ item }}:{{ full_hash }}_{{ x86_tag }}
docker manifest annotate --arch amd64 \
{{ registry.host }}/{{ registry.namespace }}/{{ distro_name }}-binary-{{ item }}:{{ full_hash }}{{ manifest_tag }} \
{{ registry.host }}/{{ registry.namespace }}/{{ distro_name }}-binary-{{ item }}:{{ full_hash }}_{{ x86_tag }}
{{ registry.host }}/{{ registry.namespace }}/{{ container_name_prefix }}-{{ item }}:{{ full_hash }}{{ manifest_tag }} \
{{ registry.host }}/{{ registry.namespace }}/{{ container_name_prefix }}-{{ item }}:{{ full_hash }}_{{ x86_tag }}
loop_control:
index_var: index
loop: "{{ built_images.stdout_lines }}"
Expand All @@ -130,15 +130,15 @@
- name: 'Push container manifests to {{ registry.host }}'
shell: >
docker manifest push -p {{ manifest_extra_opts }}
{{ registry.host }}/{{ registry.namespace }}/{{ distro_name }}-binary-{{ item }}:{{ full_hash }}{{ manifest_tag }}
{{ registry.host }}/{{ registry.namespace }}/{{ container_name_prefix }}-{{ item }}:{{ full_hash }}{{ manifest_tag }}
retries: 3
with_items: "{{ built_images.stdout_lines }}"
changed_when: true

# Check that we pushed all the things correctly to {{ registry.host }}
- name: 'Inspect manifests and {{ x86_tag }} containers in {{ registry.host }}'
shell: |
docker manifest inspect --insecure {{ registry.host }}/{{ registry.namespace }}/{{ distro_name }}-binary-{{ item.0 }}:{{ full_hash }}{{ item.1 }}
docker manifest inspect --insecure {{ registry.host }}/{{ registry.namespace }}/{{ container_name_prefix }}-{{ item.0 }}:{{ full_hash }}{{ item.1 }}
with_nested:
- "{{ built_images.stdout_lines }}"
- ["{{ manifest_tag }}", "_{{ x86_tag }}"]
Expand All @@ -147,8 +147,8 @@

- name: 'Inspect manifests and {{ ppc_tag }} containers in {{ registry.host }}'
shell: |
docker manifest inspect --insecure {{ registry.host }}/{{ registry.namespace }}/{{ distro_name }}-binary-{{ item }}:{{ full_hash }}{{ manifest_tag }}
docker manifest inspect --insecure {{ registry.host }}/{{ registry.namespace }}/{{ distro_name }}-binary-{{ item }}:{{ full_hash }}_{{ ppc_tag }}
docker manifest inspect --insecure {{ registry.host }}/{{ registry.namespace }}/{{ container_name_prefix }}-{{ item }}:{{ full_hash }}{{ manifest_tag }}
docker manifest inspect --insecure {{ registry.host }}/{{ registry.namespace }}/{{ container_name_prefix }}-{{ item }}:{{ full_hash }}_{{ ppc_tag }}
loop: "{{ built_images.stdout_lines }}"
loop_control:
index_var: index
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
body_format: json
body:
namespace: "{{ registry.namespace }}"
repository: "{{ distro_name }}-binary-{{ item }}"
description: "TripleO container for {{ distro_name }}-binary-{{ item }}"
repository: "{{ container_name_prefix }}-{{ item }}"
description: "TripleO container for {{ container_name_prefix }}-{{ item }}"
visibility: public
headers:
Authorization: "Bearer {{ registry.token }}"
Expand All @@ -55,9 +55,9 @@
# Nested loop order here is on purpose, so we push first all the images with the full hash, then we tag with the named label.
- name: Tag and push images to registry
docker_image:
name: "{{ source_registry.host }}/{{ source_registry.namespace }}/{{ distro_name }}-binary-{{ item[1] }}"
name: "{{ source_registry.host }}/{{ source_registry.namespace }}/{{ container_name_prefix }}-{{ item[1] }}"
tag: "{{ item[0] }}"
repository: "{{ registry.host }}/{{ registry.namespace }}/{{ distro_name }}-binary-{{ item[1] }}"
repository: "{{ registry.host }}/{{ registry.namespace }}/{{ container_name_prefix }}-{{ item[1] }}"
push: yes
source: local
# This force-tag is absolutely needed, if image exists with this tag,
Expand Down Expand Up @@ -86,7 +86,7 @@
tag={{ full_hash }}
for image in $(cat {{ containers_file }})
do
if docker manifest inspect --insecure "{{ registry.host }}/{{ registry.namespace }}/{{ distro_name }}-binary-${image}:${tag}" 1>/dev/null;
if docker manifest inspect --insecure "{{ registry.host }}/{{ registry.namespace }}/{{ container_name_prefix }}-${image}:${tag}" 1>/dev/null;
then
echo "$image OK";
else
Expand Down
8 changes: 6 additions & 2 deletions ci-scripts/dlrnapi_promoter/stage_containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,12 @@ def setup(self):
self.log.debug("Not excluding container %s", excluded)

for image_name in suffixes:
target_image_name = "{}-binary-{}".format(
self.distro_name, image_name)
if self.config.main['release'] in [
'queens', 'rocky', 'stein', 'train', 'ussuri']:
target_image_name = "{}-binary-{}".format(
self.distro_name, image_name)
else:
target_image_name = "openstack-{}".format(image_name)
for tag in tags:
image = "{}/{}".format(self.namespace, target_image_name)
full_image = "localhost:{}/{}".format(
Expand Down
2 changes: 1 addition & 1 deletion molecule/tripleo_common_integration/cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

- name: remove local containers
docker_image:
name: "{{ undercloud_registry['host'] }}/{{ undercloud_registry['namespace'] }}/{{ distro_name }}-binary-{{ item }}:{{ full_hash }}"
name: "{{ undercloud_registry['host'] }}/{{ undercloud_registry['namespace'] }}/{{ container_name_prefix }}-{{ item }}:{{ full_hash }}"
state: absent
vars:
ansible_python_interpreter: "~/{{ promoter_virtualenv }}/bin/python3"
Expand Down
1 change: 1 addition & 0 deletions molecule/tripleo_common_integration/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ provisioner:
containers_list:
- nova-compute
- neutron-server
container_name_prefix: openstack

# tripleo_common_integration vars
undercloud_registry:
Expand Down
2 changes: 1 addition & 1 deletion molecule/tripleo_common_integration/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
ceph_prometheus_namespace: docker.io/prom
ceph_prometheus_tag: latest
ceph_tag: v4.0.1-stable-4.0-nautilus-centos-7-x86_64
name_prefix: "{{ distro_name }}-binary-"
name_prefix: "{{ container_name_prefix }}-"
name_suffix: ''
namespace: "{{ promote_registries[0]['host'] }}/{{ promote_registries[0]['namespace'] }}"
neutron_driver: ovn
Expand Down
6 changes: 3 additions & 3 deletions molecule/tripleo_common_integration/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
- name: emulate deploy -- check containers in undercloud_registry # noqa 303
shell: |
source ~/{{ promoter_virtualenv }}/bin/activate
curl --verbose -X GET {{ undercloud_registry['host'] }}/{{ undercloud_registry['namespace'] }}/{{ distro_name }}-binary-{{ item }}/tags/list
curl --verbose -X GET {{ undercloud_registry['host'] }}/{{ undercloud_registry['namespace'] }}/{{ container_name_prefix }}-{{ item }}/tags/list
with_items: "{{ staging_containers_list }}"
changed_when: false

Expand All @@ -16,14 +16,14 @@
shell: |
source ~/{{ promoter_virtualenv }}/bin/activate
docker manifest inspect --insecure \
{{ undercloud_registry['host'] }}/{{ undercloud_registry['namespace'] }}/{{ distro_name }}-binary-{{ item }}:{{ full_hash }}
{{ undercloud_registry['host'] }}/{{ undercloud_registry['namespace'] }}/{{ container_name_prefix }}-{{ item }}:{{ full_hash }}
with_items: "{{ staging_containers_list }}"
changed_when: false

# pull staging containers from undercloud_registry
- name: emulate deploy -- pull staging containers from undercloud_registry
docker_image:
name: "{{ undercloud_registry['host'] }}/{{ undercloud_registry['namespace'] }}/{{ distro_name }}-binary-{{ item }}:{{ full_hash }}"
name: "{{ undercloud_registry['host'] }}/{{ undercloud_registry['namespace'] }}/{{ container_name_prefix }}-{{ item }}:{{ full_hash }}"
source: pull
with_items: "{{ staging_containers_list }}"
vars:
Expand Down

0 comments on commit 2dad521

Please sign in to comment.