Files
loci/roles/upload-container-image/tasks/main.yaml
Vladimir Kozhukalov a02b9a49d1 Use customized zuul-jobs roles
This is a temporary change until this is merged
https://review.opendev.org/c/zuul/zuul-jobs/+/964255

Change-Id: I37393416e40c66b292bdee22dc9e541490d428aa
Signed-off-by: Vladimir Kozhukalov <kozhukalov@gmail.com>
2025-10-17 16:08:59 -05:00

33 lines
1.3 KiB
YAML

- name: Control when we push to the upstream registry
# We only want to push upstream if we are in a release / tag pipeline or
# if we are using the tag promotion method.
block:
- name: Verify repository names
when: |
container_registry_credentials is defined
and zj_image.registry not in container_registry_credentials
loop: "{{ container_images }}"
loop_control:
loop_var: zj_image
fail:
msg: "{{ zj_image.registry }} credentials not found"
- name: Verify repository permission
when: |
container_registry_credentials[zj_image.registry].repository is defined and
not zj_image.repository | regex_search(container_registry_credentials[zj_image.registry].repository)
loop: "{{ container_images }}"
loop_control:
loop_var: zj_image
fail:
msg: "{{ zj_image.repository }} not permitted by {{ container_registry_credentials[zj_image.registry].repository }}"
- name: Upload image to container registry
loop: "{{ container_images }}"
loop_control:
loop_var: zj_image
include_tasks: push.yaml
when:
- inventory_hostname == ansible_play_hosts[0]
- not upload_container_image_promote|default(true) or promote_container_image_method|default('tag') == 'tag'