Allow disabling compression of uploaded images
This may not be required for openstack, but let's maintain parity between the swift and s3 upload roles. Change-Id: I3740528d90b27ca36d742b6069014a395252a1f3 Co-Authored-By: Simon Westphahl <simon.westphahl@bmw.de>
This commit is contained in:
@@ -4,7 +4,8 @@ This uploads a filesystem image (for example, one built by diskimage
|
||||
builder) to an OpenStack Object Store (Swift) container. The role
|
||||
returns an artifact to Zuul suitable for use by the zuul-launcher.
|
||||
|
||||
If a `raw` or `vhd` image is provided and the `zstd` command is
|
||||
If a `raw` or `vhd` image is provided,
|
||||
`upload_image_swift_compress_image` is true and the `zstd` command is
|
||||
available, it will be compressed in the way that zuul-launcher
|
||||
expects.
|
||||
|
||||
@@ -61,6 +62,15 @@ expects.
|
||||
|
||||
The object name to use when uploading.
|
||||
|
||||
.. zuul:rolevar:: upload_image_swift_compress_image
|
||||
:default: true
|
||||
|
||||
Whether to compress the image using zstd before upload.
|
||||
|
||||
Some providers may require the image to be in raw format when
|
||||
importing directly from object storage. In those cases the flag
|
||||
should be set to `false`.
|
||||
|
||||
.. zuul:rolevar:: upload_image_swift_hash_timeout
|
||||
:default: 600
|
||||
|
||||
|
||||
@@ -3,4 +3,5 @@ upload_image_swift_delete_after: 0
|
||||
upload_image_swift_filename: '{{ build_diskimage_image_root }}/{{ build_diskimage_image_name }}.{{ upload_image_swift_extension }}'
|
||||
upload_image_swift_name: '{{ zuul.build }}-{{ build_diskimage_image_name }}.{{ upload_image_swift_extension }}'
|
||||
upload_image_swift_extension: '{{ upload_image_swift_format }}'
|
||||
upload_image_swift_compress_image: true
|
||||
upload_image_swift_hash_timeout: 600
|
||||
|
||||
@@ -15,27 +15,31 @@
|
||||
poll: 0
|
||||
register: md5_task
|
||||
|
||||
- name: Check if zstd is installed
|
||||
shell: "command -v zstd || exit 1"
|
||||
register: zstd_installed
|
||||
failed_when: false
|
||||
|
||||
- name: Compress image
|
||||
when:
|
||||
- "zstd_installed.rc == 0"
|
||||
- "upload_image_swift_format in ['raw', 'vhd']"
|
||||
command: zstd '{{ upload_image_swift_filename }}'
|
||||
|
||||
- name: Set extension
|
||||
set_fact:
|
||||
zj_upload_image_swift_extension: ''
|
||||
|
||||
- name: Set extension
|
||||
- name: Compress image
|
||||
when:
|
||||
- "zstd_installed.rc == 0"
|
||||
- "upload_image_swift_format in ['raw', 'vhd']"
|
||||
set_fact:
|
||||
zj_upload_image_swift_extension: '.zst'
|
||||
- "upload_image_swift_compress_image"
|
||||
block:
|
||||
- name: Check if zstd is installed
|
||||
shell: "command -v zstd || exit 1"
|
||||
register: zstd_installed
|
||||
failed_when: false
|
||||
|
||||
- name: Compress image
|
||||
when:
|
||||
- "zstd_installed.rc == 0"
|
||||
- "upload_image_swift_format in ['raw', 'vhd']"
|
||||
command: zstd '{{ upload_image_swift_filename }}'
|
||||
|
||||
- name: Set extension
|
||||
when:
|
||||
- "zstd_installed.rc == 0"
|
||||
- "upload_image_swift_format in ['raw', 'vhd']"
|
||||
set_fact:
|
||||
zj_upload_image_swift_extension: '.zst'
|
||||
|
||||
- name: Upload image to swift
|
||||
upload_image_swift:
|
||||
|
||||
Reference in New Issue
Block a user