zuul-jobs/roles/upload-container-image/tasks/push.yaml
James E. Blair cc0c655e5f Revert "Use --password-stdin for upload-container-image"
This reverts commit 345c839db6.

This is simpler, and we don't have to worry about the tempfile write
accidentally exposing secrets.  This is similar to the way we log in
in the promote job.

Change-Id: I2a0f34e0ea3abe88fe9f26d12298baf68f1a6b2d
2023-03-21 10:18:22 -07:00

22 lines
902 B
YAML

- name: Log in to registry
command: "{{ container_command }} login -u {{ container_registry_credentials[zj_image.registry].username }} -p {{ container_registry_credentials[zj_image.registry].password }} {{ zj_image.registry }}"
no_log: true
- name: Publish images
block:
- name: Upload tag to registry
vars:
promote_tag_prefix: "{{ ('change_' + zuul.change) if (zuul.change is defined) else zuul.pipeline }}_"
command: "{{ container_command }} push {{ zj_image.repository }}:{{ upload_container_image_promote | ternary(promote_tag_prefix, '') }}{{ zj_image_tag }}"
loop: "{{ zj_image.tags | default(['latest']) }}"
loop_control:
loop_var: zj_image_tag
register: result
until: result.rc == 0
retries: 3
delay: 30
always:
- name: Log out of registry
command: "{{ container_command }} logout {{ zj_image.registry }}"