zuul-jobs/roles/build-docker-image/tasks/push.yaml
Mohammed Naser 613a6ce85f build-docker-image: Fix buildset registry pushes
If we build an image with `docker_registry` set, it will fail to
tag the image for the buildset registry since we do not prefix the
image with `docker_registry` when retagging it (if set).

This patch resolves this by adding that prefix if it is set so
it will refer to an image that exists.

Change-Id: Iba29161156c8e8ff4f79a92771456cf105d780fe
2022-04-11 15:22:00 -04:00

13 lines
638 B
YAML

- name: Tag image for buildset registry
command: >-
docker tag {{ docker_registry | ternary(docker_registry + '/', '') }}{{ zj_image.repository }}:{{ zj_image_tag }} {{ buildset_registry_alias }}:{{ buildset_registry.port }}/{{ zj_image.repository }}:{{ zj_image_tag }}
loop: "{{ zj_image.tags | default(['latest']) }}"
loop_control:
loop_var: zj_image_tag
- name: Push tag to buildset registry
command: >-
docker push {{ buildset_registry_alias }}:{{ buildset_registry.port }}/{{ zj_image.repository }}:{{ zj_image_tag }}
loop: "{{ zj_image.tags | default(['latest']) }}"
loop_control:
loop_var: zj_image_tag