Monty Taylor 64741aa73d Don't upload to the tag with buildx - only to the change tag
This is a copy/pasta error from pulling this logic over from build.
We need to upload to dockerhub but only to the change_ version
of the tag.

Change-Id: I19d1b326ad2c5b1cef846f47e667f3c3480582e7
2020-05-07 18:17:59 -05:00

40 lines
1.4 KiB
YAML

- name: Set up siblings
include_tasks: siblings.yaml
- name: Upload tag to dockerhub
# docker buildx doesn't have a separate push command, only the
# ability to push at the end of a build. We run build here with
# all the same arguments as in the buildx build tasks, so they
# should result in a noop build and just a push.
command: >-
docker buildx build {{ zj_image.path | default('.') }} -f {{ zj_image.dockerfile | default(docker_dockerfile) }}
{% if zj_image.target | default(false) -%}
--target {{ zj_image.target }}
{% endif -%}
{% for build_arg in zj_image.build_args | default([]) -%}
--build-arg {{ build_arg }}
{% endfor -%}
{% if zj_image.siblings | default(false) -%}
--build-arg "ZUUL_SIBLINGS={{ zj_image.siblings | join(' ') }}"
{% endif -%}
{% for tag in zj_image.tags | default(['latest']) -%}
{% if zuul.change | default(false) -%}
--tag {{ zj_image.repository }}:change_{{ zuul.change }}_{{ tag }}
{% endif -%}
{% endfor -%}
{% for label in zj_image.labels | default([]) -%}
--label "{{ label }}"
{% endfor %}
--label "org.zuul-ci.change={{ zuul.change }}"
--label "org.zuul-ci.change_url={{ zuul.change_url }}"
--platform={{ zj_image.arch | join(',') }}
--push
args:
chdir: "{{ zuul_work_dir }}/{{ zj_image.context }}"
environment:
DOCKER_CLI_EXPERIMENTAL: enabled
register: result
until: result.rc == 0
retries: 3
delay: 30