image-build: Pass arches around as a list
Instead of joining the arches as a comma separated string and splitting it again later. Ultimately we do need the original format to pass to koji wrapper, but we can produce that value later. Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
6c708549c8
commit
8418b68fb0
@ -75,7 +75,7 @@ class ImageBuildPhase(base.PhaseLoggerMixin, base.ImageConfigMixin, base.ConfigG
|
|||||||
def _get_arches(self, image_conf, arches):
|
def _get_arches(self, image_conf, arches):
|
||||||
if 'arches' in image_conf['image-build']:
|
if 'arches' in image_conf['image-build']:
|
||||||
arches = set(image_conf['image-build'].get('arches', [])) & arches
|
arches = set(image_conf['image-build'].get('arches', [])) & arches
|
||||||
return ','.join(sorted(arches))
|
return sorted(arches)
|
||||||
|
|
||||||
def _set_release(self, image_conf):
|
def _set_release(self, image_conf):
|
||||||
"""If release is set explicitly to None, replace it with date and respin."""
|
"""If release is set explicitly to None, replace it with date and respin."""
|
||||||
@ -122,9 +122,9 @@ class ImageBuildPhase(base.PhaseLoggerMixin, base.ImageConfigMixin, base.ConfigG
|
|||||||
|
|
||||||
can_fail = image_conf['image-build'].pop('failable', [])
|
can_fail = image_conf['image-build'].pop('failable', [])
|
||||||
if can_fail == ['*']:
|
if can_fail == ['*']:
|
||||||
can_fail = image_conf['image-build']['arches'].split(',')
|
can_fail = image_conf['image-build']['arches']
|
||||||
if can_fail:
|
if can_fail:
|
||||||
image_conf['image-build']['can_fail'] = ','.join(sorted(can_fail))
|
image_conf['image-build']['can_fail'] = sorted(can_fail)
|
||||||
|
|
||||||
cmd = {
|
cmd = {
|
||||||
"format": format,
|
"format": format,
|
||||||
@ -162,8 +162,7 @@ class CreateImageBuildThread(WorkerThread):
|
|||||||
self.worker(num, compose, variant, subvariant, cmd)
|
self.worker(num, compose, variant, subvariant, cmd)
|
||||||
|
|
||||||
def worker(self, num, compose, variant, subvariant, cmd):
|
def worker(self, num, compose, variant, subvariant, cmd):
|
||||||
arches = cmd["image_conf"]["image-build"]['arches'].split(',')
|
arches = cmd["image_conf"]["image-build"]['arches']
|
||||||
failable_arches = self.failable_arches.split(',')
|
|
||||||
dash_arches = '-'.join(arches)
|
dash_arches = '-'.join(arches)
|
||||||
log_file = compose.paths.log.log_file(
|
log_file = compose.paths.log.log_file(
|
||||||
dash_arches,
|
dash_arches,
|
||||||
@ -180,6 +179,11 @@ class CreateImageBuildThread(WorkerThread):
|
|||||||
# writes conf file for koji image-build
|
# writes conf file for koji image-build
|
||||||
self.pool.log_info("Writing image-build config for %s.%s into %s" % (
|
self.pool.log_info("Writing image-build config for %s.%s into %s" % (
|
||||||
variant, dash_arches, cmd["conf_file"]))
|
variant, dash_arches, cmd["conf_file"]))
|
||||||
|
|
||||||
|
# Join the arches into a single string. This is the value expected by
|
||||||
|
# koji config file.
|
||||||
|
cmd["image_conf"]["image-build"]['arches'] = ','.join(cmd["image_conf"]["image-build"]['arches'])
|
||||||
|
|
||||||
koji_cmd = koji_wrapper.get_image_build_cmd(cmd["image_conf"],
|
koji_cmd = koji_wrapper.get_image_build_cmd(cmd["image_conf"],
|
||||||
conf_file_dest=cmd["conf_file"],
|
conf_file_dest=cmd["conf_file"],
|
||||||
scratch=cmd['scratch'])
|
scratch=cmd['scratch'])
|
||||||
@ -207,7 +211,7 @@ class CreateImageBuildThread(WorkerThread):
|
|||||||
image_infos.append({'path': path, 'suffix': suffix, 'type': format, 'arch': arch})
|
image_infos.append({'path': path, 'suffix': suffix, 'type': format, 'arch': arch})
|
||||||
break
|
break
|
||||||
|
|
||||||
if len(image_infos) != len(cmd['format']) * (len(arches) - len(failable_arches)):
|
if len(image_infos) != len(cmd['format']) * (len(arches) - len(self.failable_arches)):
|
||||||
self.pool.log_error(
|
self.pool.log_error(
|
||||||
"Error in koji task %s. Expected to find same amount of images "
|
"Error in koji task %s. Expected to find same amount of images "
|
||||||
"as in suffixes attr in image-build (%s) for each arch (%s). Got '%s'." %
|
"as in suffixes attr in image-build (%s) for each arch (%s). Got '%s'." %
|
||||||
|
@ -66,11 +66,11 @@ class TestImageBuildPhase(PungiTestCase):
|
|||||||
'target': 'f24',
|
'target': 'f24',
|
||||||
'disk_size': 3,
|
'disk_size': 3,
|
||||||
'name': 'Fedora-Docker-Base',
|
'name': 'Fedora-Docker-Base',
|
||||||
'arches': 'amd64',
|
'arches': ['amd64'],
|
||||||
'version': 'Rawhide',
|
'version': 'Rawhide',
|
||||||
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
||||||
'distro': 'Fedora-20',
|
'distro': 'Fedora-20',
|
||||||
'can_fail': 'x86_64',
|
'can_fail': ['x86_64'],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"conf_file": self.topdir + '/work/image-build/Client/docker_Fedora-Docker-Base.cfg',
|
"conf_file": self.topdir + '/work/image-build/Client/docker_Fedora-Docker-Base.cfg',
|
||||||
@ -91,11 +91,11 @@ class TestImageBuildPhase(PungiTestCase):
|
|||||||
'target': 'f24',
|
'target': 'f24',
|
||||||
'disk_size': 3,
|
'disk_size': 3,
|
||||||
'name': 'Fedora-Docker-Base',
|
'name': 'Fedora-Docker-Base',
|
||||||
'arches': 'amd64,x86_64',
|
'arches': ['amd64', 'x86_64'],
|
||||||
'version': 'Rawhide',
|
'version': 'Rawhide',
|
||||||
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
||||||
'distro': 'Fedora-20',
|
'distro': 'Fedora-20',
|
||||||
'can_fail': 'x86_64',
|
'can_fail': ['x86_64'],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"conf_file": self.topdir + '/work/image-build/Server/docker_Fedora-Docker-Base.cfg',
|
"conf_file": self.topdir + '/work/image-build/Server/docker_Fedora-Docker-Base.cfg',
|
||||||
@ -151,7 +151,7 @@ class TestImageBuildPhase(PungiTestCase):
|
|||||||
'target': 'f24',
|
'target': 'f24',
|
||||||
'disk_size': 3,
|
'disk_size': 3,
|
||||||
'name': 'Fedora-Docker-Base',
|
'name': 'Fedora-Docker-Base',
|
||||||
'arches': 'amd64,x86_64',
|
'arches': ['amd64', 'x86_64'],
|
||||||
'version': 'Rawhide',
|
'version': 'Rawhide',
|
||||||
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
||||||
'distro': 'Fedora-20',
|
'distro': 'Fedora-20',
|
||||||
@ -207,7 +207,7 @@ class TestImageBuildPhase(PungiTestCase):
|
|||||||
'target': 'f24',
|
'target': 'f24',
|
||||||
'disk_size': 3,
|
'disk_size': 3,
|
||||||
'name': 'Fedora-Docker-Base',
|
'name': 'Fedora-Docker-Base',
|
||||||
'arches': 'amd64,x86_64',
|
'arches': ['amd64', 'x86_64'],
|
||||||
'version': '25',
|
'version': '25',
|
||||||
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
||||||
'distro': 'Fedora-20',
|
'distro': 'Fedora-20',
|
||||||
@ -305,7 +305,7 @@ class TestImageBuildPhase(PungiTestCase):
|
|||||||
'target': 'f24',
|
'target': 'f24',
|
||||||
'disk_size': 3,
|
'disk_size': 3,
|
||||||
'name': 'Fedora-Docker-Base',
|
'name': 'Fedora-Docker-Base',
|
||||||
'arches': 'x86_64',
|
'arches': ['x86_64'],
|
||||||
'version': 'Rawhide',
|
'version': 'Rawhide',
|
||||||
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
||||||
'distro': 'Fedora-20',
|
'distro': 'Fedora-20',
|
||||||
@ -369,7 +369,7 @@ class TestImageBuildPhase(PungiTestCase):
|
|||||||
'target': 'f24',
|
'target': 'f24',
|
||||||
'disk_size': 3,
|
'disk_size': 3,
|
||||||
'name': 'Fedora-Docker-Base',
|
'name': 'Fedora-Docker-Base',
|
||||||
'arches': 'x86_64',
|
'arches': ['x86_64'],
|
||||||
'version': 'Rawhide',
|
'version': 'Rawhide',
|
||||||
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
||||||
'distro': 'Fedora-20',
|
'distro': 'Fedora-20',
|
||||||
@ -430,7 +430,7 @@ class TestImageBuildPhase(PungiTestCase):
|
|||||||
'target': 'f24',
|
'target': 'f24',
|
||||||
'disk_size': 3,
|
'disk_size': 3,
|
||||||
'name': 'Fedora-Docker-Base',
|
'name': 'Fedora-Docker-Base',
|
||||||
'arches': 'x86_64',
|
'arches': ['x86_64'],
|
||||||
'version': 'Rawhide',
|
'version': 'Rawhide',
|
||||||
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
||||||
'distro': 'Fedora-20',
|
'distro': 'Fedora-20',
|
||||||
@ -603,11 +603,11 @@ class TestImageBuildPhase(PungiTestCase):
|
|||||||
'target': 'f24',
|
'target': 'f24',
|
||||||
'disk_size': 3,
|
'disk_size': 3,
|
||||||
'name': 'Fedora-Docker-Base',
|
'name': 'Fedora-Docker-Base',
|
||||||
'arches': 'x86_64',
|
'arches': ['x86_64'],
|
||||||
'version': 'Rawhide',
|
'version': 'Rawhide',
|
||||||
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
||||||
'distro': 'Fedora-20',
|
'distro': 'Fedora-20',
|
||||||
'can_fail': 'x86_64',
|
'can_fail': ['x86_64'],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"conf_file": self.topdir + '/work/image-build/Server-optional/docker_Fedora-Docker-Base.cfg',
|
"conf_file": self.topdir + '/work/image-build/Server-optional/docker_Fedora-Docker-Base.cfg',
|
||||||
@ -663,11 +663,11 @@ class TestImageBuildPhase(PungiTestCase):
|
|||||||
'target': 'f24',
|
'target': 'f24',
|
||||||
'disk_size': 3,
|
'disk_size': 3,
|
||||||
'name': 'Fedora-Docker-Base',
|
'name': 'Fedora-Docker-Base',
|
||||||
'arches': 'amd64,x86_64',
|
'arches': ['amd64', 'x86_64'],
|
||||||
'version': 'Rawhide',
|
'version': 'Rawhide',
|
||||||
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
||||||
'distro': 'Fedora-20',
|
'distro': 'Fedora-20',
|
||||||
'can_fail': 'amd64,x86_64',
|
'can_fail': ['amd64', 'x86_64'],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"conf_file": self.topdir + '/work/image-build/Server/docker_Fedora-Docker-Base.cfg',
|
"conf_file": self.topdir + '/work/image-build/Server/docker_Fedora-Docker-Base.cfg',
|
||||||
@ -703,7 +703,7 @@ class TestCreateImageBuildThread(PungiTestCase):
|
|||||||
'target': 'f24',
|
'target': 'f24',
|
||||||
'disk_size': 3,
|
'disk_size': 3,
|
||||||
'name': 'Fedora-Docker-Base',
|
'name': 'Fedora-Docker-Base',
|
||||||
'arches': 'amd64,x86_64',
|
'arches': ['amd64', 'x86_64'],
|
||||||
'version': 'Rawhide',
|
'version': 'Rawhide',
|
||||||
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
||||||
'distro': 'Fedora-20',
|
'distro': 'Fedora-20',
|
||||||
@ -743,6 +743,7 @@ class TestCreateImageBuildThread(PungiTestCase):
|
|||||||
with mock.patch('time.sleep'):
|
with mock.patch('time.sleep'):
|
||||||
t.process((compose, cmd), 1)
|
t.process((compose, cmd), 1)
|
||||||
|
|
||||||
|
self.assertEqual(cmd['image_conf']['image-build']['arches'], 'amd64,x86_64')
|
||||||
self.assertItemsEqual(
|
self.assertItemsEqual(
|
||||||
koji_wrapper.get_image_build_cmd.call_args_list,
|
koji_wrapper.get_image_build_cmd.call_args_list,
|
||||||
[mock.call(cmd['image_conf'],
|
[mock.call(cmd['image_conf'],
|
||||||
@ -832,11 +833,11 @@ class TestCreateImageBuildThread(PungiTestCase):
|
|||||||
'target': 'f24',
|
'target': 'f24',
|
||||||
'disk_size': 3,
|
'disk_size': 3,
|
||||||
'name': 'Fedora-Docker-Base',
|
'name': 'Fedora-Docker-Base',
|
||||||
'arches': 'amd64,x86_64',
|
'arches': ['amd64', 'x86_64'],
|
||||||
'version': 'Rawhide',
|
'version': 'Rawhide',
|
||||||
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
||||||
'distro': 'Fedora-20',
|
'distro': 'Fedora-20',
|
||||||
"can_fail": 'amd64,x86_64',
|
"can_fail": ['amd64', 'x86_64'],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"conf_file": 'amd64,x86_64-Client-Fedora-Docker-Base-docker',
|
"conf_file": 'amd64,x86_64-Client-Fedora-Docker-Base-docker',
|
||||||
@ -880,11 +881,11 @@ class TestCreateImageBuildThread(PungiTestCase):
|
|||||||
'target': 'f24',
|
'target': 'f24',
|
||||||
'disk_size': 3,
|
'disk_size': 3,
|
||||||
'name': 'Fedora-Docker-Base',
|
'name': 'Fedora-Docker-Base',
|
||||||
'arches': 'amd64,x86_64',
|
'arches': ['amd64', 'x86_64'],
|
||||||
'version': 'Rawhide',
|
'version': 'Rawhide',
|
||||||
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
||||||
'distro': 'Fedora-20',
|
'distro': 'Fedora-20',
|
||||||
'can_fail': 'amd64,x86_64',
|
'can_fail': ['amd64', 'x86_64'],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"conf_file": 'amd64,x86_64-Client-Fedora-Docker-Base-docker',
|
"conf_file": 'amd64,x86_64-Client-Fedora-Docker-Base-docker',
|
||||||
@ -923,11 +924,11 @@ class TestCreateImageBuildThread(PungiTestCase):
|
|||||||
'target': 'f24',
|
'target': 'f24',
|
||||||
'disk_size': 3,
|
'disk_size': 3,
|
||||||
'name': 'Fedora-Docker-Base',
|
'name': 'Fedora-Docker-Base',
|
||||||
'arches': 'amd64,x86_64',
|
'arches': ['amd64', 'x86_64'],
|
||||||
'version': 'Rawhide',
|
'version': 'Rawhide',
|
||||||
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
||||||
'distro': 'Fedora-20',
|
'distro': 'Fedora-20',
|
||||||
'can_fail': 'amd64',
|
'can_fail': ['amd64'],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"conf_file": 'amd64,x86_64-Client-Fedora-Docker-Base-docker',
|
"conf_file": 'amd64,x86_64-Client-Fedora-Docker-Base-docker',
|
||||||
|
Loading…
Reference in New Issue
Block a user