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
1 changed files with 23 additions and 20 deletions

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
# results will be pulled into the compose.
EXTENSIONS = {
'docker': 'tar.gz',
'liveimg-squashfs': 'liveimg.squashfs',
'qcow': 'qcow',
'qcow2': 'qcow2',
'raw': 'raw',
'raw-xz': 'raw.xz',
'rhevm-ova': 'rhevm.ova',
'tar-gz': 'tar.gz',
'vagrant-hyperv': 'vagrant-hyperv.box',
'vagrant-libvirt': 'vagrant-libvirt.box',
'vagrant-virtualbox': 'vagrant-virtualbox.box',
'vagrant-vmware-fusion': 'vagrant-vmware-fusion.box',
'vdi': 'vdi',
'vmdk': 'vdmk',
'vpc': 'vhd',
'vsphere-ova': 'vsphere.ova',
'docker': ['tar.gz', 'tar.xz'],
'liveimg-squashfs': ['liveimg.squashfs'],
'qcow': ['qcow'],
'qcow2': ['qcow2'],
'raw': ['raw'],
'raw-xz': ['raw.xz'],
'rhevm-ova': ['rhevm.ova'],
'tar-gz': ['tar.gz'],
'vagrant-hyperv': ['vagrant-hyperv.box'],
'vagrant-libvirt': ['vagrant-libvirt.box'],
'vagrant-virtualbox': ['vagrant-virtualbox.box'],
'vagrant-vmware-fusion': ['vagrant-vmware-fusion.box'],
'vdi': ['vdi'],
'vmdk': ['vdmk'],
'vpc': ['vhd'],
'vsphere-ova': ['vsphere.ova'],
}
@ -216,10 +216,13 @@ class CreateImageBuildThread(WorkerThread):
for arch, paths in paths.items():
for path in paths:
for format in cmd['image_conf']['image-build']['format']:
suffix = EXTENSIONS[format]
if path.endswith(suffix):
image_infos.append({'path': path, 'suffix': suffix, 'type': format, 'arch': arch})
break
for suffix in EXTENSIONS[format]:
if path.endswith(suffix):
image_infos.append({'path': path,
'suffix': suffix,
'type': format,
'arch': arch})
break
# 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