zuul-jobs/roles/push-to-intermediate-registry/tasks/push-image.yaml
Monty Taylor 5f31625a94 Add --all to skopeo copy from insecure registry
skopeo needs to be told to copy all instances of a given image,
otherwise it just grabs one of them.

https://github.com/containers/skopeo/pull/741

Change-Id: If78ad50602e745ef7747d983b987cf964ff6e67f
2020-05-08 15:25:12 -05:00

31 lines
1.3 KiB
YAML

# To support usage with both docker and podman, the buildset registry
# keeps "docker.io" entries un-namespaced, and any other namespaces
# are namespaced. Therefore, if we see docker.io in the repository
# name, we strip it here.
- name: Push tag to intermediate registry
command: >-
skopeo --insecure-policy copy --all
docker://127.0.0.1:{{ socat_port }}/{{ zj_image.repository | regex_replace('^docker\.io/(.*)', '\1') }}:{{ zj_image_tag }}
docker://{{ intermediate_registry.host | ipwrap }}:{{ intermediate_registry.port }}/{{ zj_image.repository }}:{{ zuul.build }}_{{ zj_image_tag }}
retries: 3
register: result
until: result is success
loop: "{{ zj_image.tags | default(['latest']) }}"
loop_control:
loop_var: zj_image_tag
- name: Return artifact to Zuul
zuul_return:
data:
zuul:
artifacts:
- name: "{{ zj_image.repository }}:{{ zj_image_tag }}"
url: "docker://{{ intermediate_registry.host | ipwrap }}:{{ intermediate_registry.port }}/{{ zj_image.repository }}:{{ zuul.build }}_{{ zj_image_tag }}"
metadata:
type: container_image
repository: "{{ zj_image.repository }}"
tag: "{{ zj_image_tag }}"
loop: "{{ zj_image.tags | default(['latest']) }}"
loop_control:
loop_var: zj_image_tag