buildinstall: Add option to disable it

Fixes: https://pagure.io/pungi/issue/854
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2018-03-13 15:54:52 +01:00
parent 340ae4d286
commit 95bb147015
4 changed files with 48 additions and 0 deletions

View File

@ -504,6 +504,11 @@ Options
task using HTTP and set the output directory for this task to
``buildinstall_topdir``. Once the runroot task finishes, Pungi will copy
the results of runroot tasks to the compose working directory.
**buildinstall_skip**
(*list*) -- mapping that defines which variants and arches to skip during
buildinstall; format: ``[(variant_uid_regex, {arch|*: True})]``. This is
only supported for lorax.
Example
-------
@ -525,6 +530,13 @@ Example
})
]
# Don't run buildinstall phase for Modular variant
buildinstall_skip = [
('^Modular', {
'*': True
})
]
.. note::

View File

@ -727,6 +727,7 @@ def make_schema():
"buildinstall_topdir": {"type": "string"},
"buildinstall_kickstart": {"$ref": "#/definitions/str_or_scm_dict"},
"buildinstall_use_guestmount": {"type": "boolean", "default": True},
"buildinstall_skip": _variant_arch_mapping({"type": "boolean"}),
"global_ksurl": {"type": "string"},
"global_version": {"type": "string"},

View File

@ -134,10 +134,18 @@ class BuildinstallPhase(PhaseBase):
repo_baseurl = translate_path(self.compose, repo_baseurl)
if self.buildinstall_method == "lorax":
buildarch = get_valid_arches(arch)[0]
for variant in self.compose.get_variants(arch=arch, types=['variant']):
if variant.is_empty:
continue
skip = get_arch_variant_data(self.compose.conf, "buildinstall_skip", arch, variant)
if skip == [True]:
self.compose.log_info(
'Skipping buildinstall for %s.%s due to config option' % (variant, arch))
continue
volid = get_volid(self.compose, arch, variant=variant, disc_type=disc_type)
commands.append(
(variant,

View File

@ -43,6 +43,33 @@ class TestBuildinstallPhase(PungiTestCase):
self.assertTrue(phase.skip())
@mock.patch('pungi.phases.buildinstall.ThreadPool')
@mock.patch('pungi.phases.buildinstall.LoraxWrapper')
@mock.patch('pungi.phases.buildinstall.get_volid')
def test_skip_option(self, get_volid, loraxCls, poolCls):
compose = BuildInstallCompose(self.topdir, {
'bootable': True,
'buildinstall_method': 'lorax',
'buildinstall_skip': [
('^Server$', {
'amd64': True
}),
('^Client$', {
'*': True,
}),
]
})
get_volid.return_value = 'vol_id'
loraxCls.return_value.get_lorax_cmd.return_value = ['lorax', '...']
phase = BuildinstallPhase(compose)
phase.run()
pool = poolCls.return_value
self.assertEqual(1, len(pool.queue_put.mock_calls))
def test_does_not_skip_on_bootable(self):
compose = BuildInstallCompose(self.topdir, {'bootable': True})
compose.just_phases = None