Compress raw/vhd images

This uses zstd to compress raw and vhd images before uploading to
temporary storage.  The executor will detect the .zst extension and
decompress them before uploading to the cloud.

Depends-On: https://review.opendev.org/935956
Change-Id: I76303cbb3f1bbaf99ba7852bf1853dcc28b6d9b3
This commit is contained in:
James E. Blair 2024-11-21 10:57:04 -08:00 committed by Clark Boylan
parent b7fa1115f3
commit 530959042e
3 changed files with 29 additions and 15 deletions

View File

@ -0,0 +1,27 @@
- name: Compress image
when: "upload_image_format in ['raw', 'vhd']"
command: zstd '{{ build_diskimage_image_root }}/{{ build_diskimage_image_name }}.{{ upload_image_format }}'
- name: Set extension
when: "upload_image_format in ['raw', 'vhd']"
set_fact:
upload_image_extension: '{{ upload_image_format }}.zst'
- name: Set extension
when: "upload_image_format not in ['raw', 'vhd']"
set_fact:
upload_image_extension: '{{ upload_image_format }}'
- name: Upload image
no_log: true
include_role:
name: image-upload-swift
vars:
cloud:
auth_type: 'v3applicationcredential'
auth:
auth_url: 'https://keystone.api.sjc3.rackspacecloud.com/v3'
application_credential_id: '{{ image_upload_secret.application_credential_id }}'
application_credential_secret: '{{ image_upload_secret.application_credential_secret }}'
user_domain_name: rackspace_cloud_domain
container: images-1f49951f5beb
filename: '{{ build_diskimage_image_root }}/{{ build_diskimage_image_name }}.{{ upload_image_extension }}'
name: '{{ zuul.build }}-{{ build_diskimage_image_name }}.{{ upload_image_extension }}'
delete_after: 259200

View File

@ -1,22 +1,8 @@
- hosts: all
tasks:
- name: Upload image
no_log: true
when: image_upload_secret is defined and zuul_success
with_items: '{{ build_diskimage_formats }}'
loop_control:
loop_var: upload_image_format
include_role:
name: image-upload-swift
vars:
cloud:
auth_type: 'v3applicationcredential'
auth:
auth_url: 'https://keystone.api.sjc3.rackspacecloud.com/v3'
application_credential_id: '{{ image_upload_secret.application_credential_id }}'
application_credential_secret: '{{ image_upload_secret.application_credential_secret }}'
user_domain_name: rackspace_cloud_domain
container: images-1f49951f5beb
filename: '{{ build_diskimage_image_root }}/{{ build_diskimage_image_name }}.{{ upload_image_format }}'
name: '{{ zuul.build }}-{{ build_diskimage_image_name }}.{{ upload_image_format }}'
delete_after: 259200
include_tasks: post-inner.yaml

View File

@ -9,6 +9,7 @@
# The following are required for the image upload
- python3-openstacksdk
- python3-oslo.utils
- zstd
- name: Setup dib directories
become: true
shell: |