Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DEV-1039] Pull retag push fix #129

Merged
merged 1 commit into from
Sep 9, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions etc/kayobe/ansible/pull-retag-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@

- name: Build a list of images
vars:
image: "{{ kolla_base_distro }}-{{ image_name }}"
image: "{{ image_name }}"
image_name: "{{ item.1.split()[2] }}"
set_fact:
images: "{{ (images | default([])) + [image] }}"
Expand All @@ -80,24 +80,24 @@
- name: Pull container images (may take a long time)
become: true
vars:
remote_image: "{% if docker_pull_registry != '' %}{{ docker_pull_registry }}/{% endif %}{{ docker_pull_namespace }}/{{ item }}:{{ docker_pull_tag }}"
remote_image: "{% if docker_pull_registry != '' %}{{ docker_pull_registry }}/{% endif %}{{ docker_pull_namespace }}/{{ item }}:{{ docker_pull_tag }}-{{ kolla_base_distro }}-{{ ansible_facts.distribution_release }}"
Copy link
Member

@markgoddard markgoddard Sep 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think ansible_facts.distribution_release is always correct here. For example, on CentOS stream the image suffix is stream8.

Copy link
Contributor Author

@g0rgamesh g0rgamesh Sep 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would ansible_distribution_release be better?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's just a different way of accessing the same thing. Here's how kolla-ansible does it:

https://opendev.org/openstack/kolla-ansible/src/commit/a396284a83e7624a951190b36fbad79812f1937d/ansible/group_vars/all.yml#L1196

command:
cmd: "docker pull {{ remote_image }}"
with_items: "{{ images }}"

- name: Retag container images
become: true
vars:
remote_image: "{% if docker_pull_registry != '' %}{{ docker_pull_registry }}/{% endif %}{{ docker_pull_namespace }}/{{ item }}:{{ docker_pull_tag }}"
local_image: "{{ kolla_docker_registry }}/{{ kolla_docker_namespace }}/{{ item }}:{{ kolla_tag }}"
remote_image: "{% if docker_pull_registry != '' %}{{ docker_pull_registry }}/{% endif %}{{ docker_pull_namespace }}/{{ item }}:{{ docker_pull_tag }}-{{ kolla_base_distro }}-{{ ansible_facts.distribution_release }}"
local_image: "{{ kolla_docker_registry }}/{{ kolla_docker_namespace }}/{{ item }}:{{ kolla_tag }}-{{ kolla_base_distro }}-{{ ansible_facts.distribution_release }}"
command:
cmd: "docker tag {{ remote_image }} {{ local_image }}"
with_items: "{{ images }}"

- name: Push container images (may take a long time)
become: true
vars:
local_image: "{{ kolla_docker_registry }}/{{ kolla_docker_namespace }}/{{ item }}:{{ kolla_tag }}"
local_image: "{{ kolla_docker_registry }}/{{ kolla_docker_namespace }}/{{ item }}:{{ kolla_tag }}-{{ kolla_base_distro }}-{{ ansible_facts.distribution_release }}"
command:
cmd: "docker push {{ local_image }}"
with_items: "{{ images }}"