James E. Blair 45eea2f191 Return image artifacts
Also, only run the upload tasks if the main playbook is sucessful.

Change-Id: I72c7fc34e083de7096f626e1f52dfdadd35c463f
2024-10-08 15:16:17 -07:00

51 lines
1.9 KiB
YAML

# Run the checksums in the background while we're uploading
- name: Get sha256 hash
stat:
path: '{{ ansible_user_dir }}/dib-images/{{ build_diskimage_image_name }}.{{ upload_image_format }}'
checksum_algorithm: sha256
async: 600
poll: 0
register: sha256_task
- name: Get md5 hash
stat:
path: '{{ ansible_user_dir }}/dib-images/{{ build_diskimage_image_name }}.{{ upload_image_format }}'
checksum_algorithm: md5
async: 600
poll: 0
register: md5_task
- name: Upload image
no_log: true
command: swift --os-auth-url 'https://keystone.api.sjc3.rackspacecloud.com/v3' --auth-version 3 --os-application-credential-id '{{ image_upload_secret.application_credential_id }}' --os-application-credential-secret '{{ image_upload_secret.application_credential_secret }}' --os-auth-type v3applicationcredential upload images-a3d39eaeea5f '{{ ansible_user_dir }}/dib-images/{{ build_diskimage_image_name }}.{{ upload_image_format }}' --object-name '{{ zuul.build }}-{{ build_diskimage_image_name }}.{{ upload_image_format }}' --verbose --use-slo --segment-size 500M
- 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_format }} image'
url: "https://swift.api.sjc3.rackspacecloud.com/v1/AUTH_f063ac0bb70c486db47bcf2105eebcbd/images-a3d39eaeea5f/{{ zuul.build }}-{{ build_diskimage_image_name }}.{{ upload_image_format }}"
metadata:
type: 'zuul_image'
image_name: '{{ build_diskimage_image_name }}'
format: '{{ upload_image_format }}'
sha256: '{{ sha256.stat.checksum }}'
md5sum: '{{ md5.stat.checksum }}'