zuul-jobs/roles/push-to-intermediate-registry/tasks/push-image.yaml
James E. Blair cbff0cc355 push-to-registry: handle undefined docker_images
So that this role may be used unconditionally in jobs which may
or may not actually build images, skip the tasks if the
docker_images variable is undefined.

Change-Id: I6ef0c80230de628f86f523878020c82ce81a1e60
2019-02-19 17:49:21 -08:00

27 lines
1.1 KiB
YAML

- name: Push tag to intermediate registry
command: >-
skopeo --insecure-policy copy
--src-creds={{ buildset_registry.username }}:{{ buildset_registry.password }}
--dest-creds={{ intermediate_registry.username }}:{{ intermediate_registry.password }}
docker://{{ buildset_registry.host }}:{{ buildset_registry.port }}/{{ image.repository }}:{{ image_tag }}
docker://{{ intermediate_registry.host }}:{{ intermediate_registry.port}}/{{ image.repository }}:{{ zuul.build }}_{{ image_tag }}
loop: "{{ image.tags | default(['latest']) }}"
loop_control:
loop_var: image_tag
# no_log: true TODO(corvus) replace
- name: Return artifact to Zuul
zuul_return:
data:
zuul:
artifacts:
- name: "image_{{ image.repository }}:{{ image_tag }}"
url: "docker://{{ intermediate_registry.host }}:{{ intermediate_registry.port}}/{{ image.repository }}:{{ zuul.build }}_{{ image_tag}}"
metadata:
type: container_image
repository: "{{ image.repository }}"
tag: "{{ image_tag }}"
loop: "{{ image.tags | default(['latest']) }}"
loop_control:
loop_var: image_tag