image-build: Accept tar.xz extension for docker images

Fixes: https://pagure.io/pungi/issue/863
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2018-03-08 09:07:48 +01:00
parent 6514dc85f3
commit 11c2af3246

View File

@ -20,22 +20,22 @@ from productmd.images import Image
# name will be ending with. The extensions are used to filter out which task # name will be ending with. The extensions are used to filter out which task
# results will be pulled into the compose. # results will be pulled into the compose.
EXTENSIONS = { EXTENSIONS = {
'docker': 'tar.gz', 'docker': ['tar.gz', 'tar.xz'],
'liveimg-squashfs': 'liveimg.squashfs', 'liveimg-squashfs': ['liveimg.squashfs'],
'qcow': 'qcow', 'qcow': ['qcow'],
'qcow2': 'qcow2', 'qcow2': ['qcow2'],
'raw': 'raw', 'raw': ['raw'],
'raw-xz': 'raw.xz', 'raw-xz': ['raw.xz'],
'rhevm-ova': 'rhevm.ova', 'rhevm-ova': ['rhevm.ova'],
'tar-gz': 'tar.gz', 'tar-gz': ['tar.gz'],
'vagrant-hyperv': 'vagrant-hyperv.box', 'vagrant-hyperv': ['vagrant-hyperv.box'],
'vagrant-libvirt': 'vagrant-libvirt.box', 'vagrant-libvirt': ['vagrant-libvirt.box'],
'vagrant-virtualbox': 'vagrant-virtualbox.box', 'vagrant-virtualbox': ['vagrant-virtualbox.box'],
'vagrant-vmware-fusion': 'vagrant-vmware-fusion.box', 'vagrant-vmware-fusion': ['vagrant-vmware-fusion.box'],
'vdi': 'vdi', 'vdi': ['vdi'],
'vmdk': 'vdmk', 'vmdk': ['vdmk'],
'vpc': 'vhd', 'vpc': ['vhd'],
'vsphere-ova': 'vsphere.ova', 'vsphere-ova': ['vsphere.ova'],
} }
@ -216,10 +216,13 @@ class CreateImageBuildThread(WorkerThread):
for arch, paths in paths.items(): for arch, paths in paths.items():
for path in paths: for path in paths:
for format in cmd['image_conf']['image-build']['format']: for format in cmd['image_conf']['image-build']['format']:
suffix = EXTENSIONS[format] for suffix in EXTENSIONS[format]:
if path.endswith(suffix): if path.endswith(suffix):
image_infos.append({'path': path, 'suffix': suffix, 'type': format, 'arch': arch}) image_infos.append({'path': path,
break 'suffix': suffix,
'type': format,
'arch': arch})
break
# The usecase here is that you can run koji image-build with multiple --format # The usecase here is that you can run koji image-build with multiple --format
# It's ok to do it serialized since we're talking about max 2 images per single # It's ok to do it serialized since we're talking about max 2 images per single