Return image artifacts
Also, only run the upload tasks if the main playbook is sucessful. Change-Id: I72c7fc34e083de7096f626e1f52dfdadd35c463f
This commit is contained in:
parent
91a3c71eef
commit
45eea2f191
50
playbooks/opendev-build-diskimage-base/post-inner.yaml
Normal file
50
playbooks/opendev-build-diskimage-base/post-inner.yaml
Normal file
@ -0,0 +1,50 @@
|
||||
# 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 }}'
|
@ -1,9 +1,8 @@
|
||||
- hosts: all
|
||||
tasks:
|
||||
- name: Upload image
|
||||
when: image_upload_secret is defined
|
||||
no_log: true
|
||||
when: image_upload_secret is defined and zuul_success
|
||||
with_items: '{{ build_diskimage_formats }}'
|
||||
loop_control:
|
||||
loop_var: upload_image_format
|
||||
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
|
||||
include_tasks: post-inner.yaml
|
||||
|
Loading…
x
Reference in New Issue
Block a user