build-docker-image: further cleanup buildx path

The build we are doing here goes only into the temporary registry, and
is then pulled back locally.  So this image only needs the tag that it
will get pulled with, which is done just below -- we can remove the
"tag_prefix" and buildset-registry tags that won't be used.

Change-Id: Ia9a3d3476e7971ee5a094f74628a6f6575b535a9
This commit is contained in:
Ian Wienand 2023-02-07 09:51:29 +11:00
parent 8ff0045a83
commit f4ffc94694

View File

@ -5,8 +5,6 @@
# they can be pulled back onto the host image cache), and also tags # they can be pulled back onto the host image cache), and also tags
# them for the buildset registry if one is present. # them for the buildset registry if one is present.
- name: Set base docker build command - name: Set base docker build command
vars:
tag_prefix: "{{ ('change_' + zuul.change) if (zuul.change is defined) else zuul.pipeline }}_"
set_fact: set_fact:
docker_buildx_command: >- docker_buildx_command: >-
docker buildx build {{ zj_image.path | default('.') }} -f {{ zj_image.dockerfile | default(docker_dockerfile) }} docker buildx build {{ zj_image.path | default('.') }} -f {{ zj_image.dockerfile | default(docker_dockerfile) }}
@ -20,10 +18,6 @@
--build-arg "ZUUL_SIBLINGS={{ zj_image.siblings | join(' ') }}" --build-arg "ZUUL_SIBLINGS={{ zj_image.siblings | join(' ') }}"
{% endif -%} {% endif -%}
{% for tag in zj_image.tags | default(['latest']) -%} {% for tag in zj_image.tags | default(['latest']) -%}
--tag {{ temp_registry.host }}:{{ temp_registry.port }}/{{ zj_image.repository }}:{{ tag_prefix }}{{ tag }}
{% if buildset_registry | default(false) -%}
--tag {{ buildset_registry_alias }}:{{ buildset_registry.port }}/{{ zj_image.repository }}:{{ tag_prefix }}{{ tag }}
{% endif -%}
--tag {{ temp_registry.host }}:{{ temp_registry.port }}/{{ zj_image.repository }}:{{ tag }} --tag {{ temp_registry.host }}:{{ temp_registry.port }}/{{ zj_image.repository }}:{{ tag }}
{% if buildset_registry | default(false) -%} {% if buildset_registry | default(false) -%}
--tag {{ buildset_registry_alias }}:{{ buildset_registry.port }}/{{ zj_image.repository }}:{{ tag }} --tag {{ buildset_registry_alias }}:{{ buildset_registry.port }}/{{ zj_image.repository }}:{{ tag }}