[image-build] Allow using external install trees
This is needed for the twoweek Fedora atomic release to point to regular nightly composes. Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
385f0e950c
commit
bb4afea4f1
@ -57,6 +57,8 @@ class ImageBuildPhase(base.ImageConfigMixin, base.ConfigGuardedPhase):
|
||||
dict.
|
||||
"""
|
||||
install_tree_from = image_conf.pop('install_tree_from', variant.uid)
|
||||
if '://' in install_tree_from:
|
||||
return install_tree_from
|
||||
install_tree_source = self.compose.variants.get(install_tree_from)
|
||||
if not install_tree_source:
|
||||
raise RuntimeError(
|
||||
|
@ -309,6 +309,66 @@ class TestImageBuildPhase(PungiTestCase):
|
||||
"scratch": False,
|
||||
})
|
||||
|
||||
@mock.patch('pungi.phases.image_build.ThreadPool')
|
||||
def test_image_build_set_external_install_tree(self, ThreadPool):
|
||||
compose = DummyCompose(self.topdir, {
|
||||
'image_build': {
|
||||
'^Server$': [
|
||||
{
|
||||
'image-build': {
|
||||
'format': [('docker', 'tar.xz')],
|
||||
'name': 'Fedora-Docker-Base',
|
||||
'target': 'f24',
|
||||
'version': 'Rawhide',
|
||||
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
||||
'kickstart': "fedora-docker-base.ks",
|
||||
'distro': 'Fedora-20',
|
||||
'disk_size': 3,
|
||||
'arches': ['x86_64'],
|
||||
'install_tree_from': 'http://example.com/install-tree/',
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
'koji_profile': 'koji',
|
||||
})
|
||||
|
||||
phase = ImageBuildPhase(compose)
|
||||
|
||||
phase.run()
|
||||
|
||||
# assert at least one thread was started
|
||||
self.assertTrue(phase.pool.add.called)
|
||||
|
||||
self.assertTrue(phase.pool.queue_put.called_once)
|
||||
args, kwargs = phase.pool.queue_put.call_args
|
||||
self.assertEqual(args[0][0], compose)
|
||||
self.maxDiff = None
|
||||
self.assertDictEqual(args[0][1], {
|
||||
"format": [('docker', 'tar.xz')],
|
||||
"image_conf": {
|
||||
'image-build': {
|
||||
'install_tree': 'http://example.com/install-tree/',
|
||||
'kickstart': 'fedora-docker-base.ks',
|
||||
'format': 'docker',
|
||||
'repo': ','.join([self.topdir + '/compose/Server/$arch/os']),
|
||||
'variant': compose.variants['Server'],
|
||||
'target': 'f24',
|
||||
'disk_size': 3,
|
||||
'name': 'Fedora-Docker-Base',
|
||||
'arches': 'x86_64',
|
||||
'version': 'Rawhide',
|
||||
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
||||
'distro': 'Fedora-20',
|
||||
}
|
||||
},
|
||||
"conf_file": self.topdir + '/work/image-build/Server/docker_Fedora-Docker-Base.cfg',
|
||||
"image_dir": self.topdir + '/compose/Server/%(arch)s/images',
|
||||
"relative_image_dir": 'Server/%(arch)s/images',
|
||||
"link_type": 'hardlink-or-copy',
|
||||
"scratch": False,
|
||||
})
|
||||
|
||||
@mock.patch('pungi.phases.image_build.ThreadPool')
|
||||
def test_image_build_create_release(self, ThreadPool):
|
||||
compose = DummyCompose(self.topdir, {
|
||||
|
Loading…
Reference in New Issue
Block a user