James E. Blair 4b025bbf2f Add upload-image-swift role
This is a near-copy of the swift-upload-image role in
opendev/zuul-providers.  This is to share the opendev-developed role
with the wider zuul community as we start to test zuul-launcher.

Change-Id: I95ef921f08fabae9fce2e57884905b11b7d0c1cb
2025-03-17 14:38:40 -07:00

57 lines
1.4 KiB
YAML

# Run the checksums in the background while we're uploading
- name: Get sha256 hash
stat:
path: '{{ upload_image_swift_filename }}'
checksum_algorithm: sha256
async: 600
poll: 0
register: sha256_task
- name: Get md5 hash
stat:
path: '{{ upload_image_swift_filename }}'
checksum_algorithm: md5
async: 600
poll: 0
register: md5_task
- name: Upload image to swift
no_log: true
upload_image_swift:
cloud: '{{ upload_image_swift_cloud_config }}'
container: '{{ upload_image_swift_container }}'
filename: '{{ upload_image_swift_filename }}'
name: '{{ upload_image_swift_name }}'
delete_after: '{{ upload_image_swift_delete_after }}'
register: upload_results
- name: Wait for sha256
async_status:
jid: "{{ sha256_task.ansible_job_id }}"
register: sha256
until: sha256.finished
retries: 1
delay: 10
- name: Wait for md5
async_status:
jid: "{{ md5_task.ansible_job_id }}"
register: md5
until: md5.finished
retries: 1
delay: 10
- name: Return artifact to Zuul
zuul_return:
data:
zuul:
artifacts:
- name: '{{ upload_image_swift_format }} image'
url: '{{ upload_results.url }}'
metadata:
type: 'zuul_image'
image_name: '{{ upload_image_swift_image_name }}'
format: '{{ upload_image_swift_format }}'
sha256: '{{ sha256.stat.checksum }}'
md5sum: '{{ md5.stat.checksum }}'