buildinstall: Add extra repos
A new configuration option is added that allows users to point lorax to extra repositories. This can be handy if some tools to create the bootable image are not part of the product itself. Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com> JIRA: COMPOSE-2253
This commit is contained in:
parent
1436ea2b03
commit
d9e2101b08
@ -493,6 +493,9 @@ Options
|
||||
* ``add_arch_template`` -- *[str]* (default empty)
|
||||
* ``add_template_var`` -- *[str]* (default empty)
|
||||
* ``add_arch_template_var`` -- *[str]* (default empty)
|
||||
**lorax_extra_sources**
|
||||
(*list*) -- a variant/arch mapping with urls for extra source repositories
|
||||
added to Lorax command line. Either one repo or a list can be specified.
|
||||
**buildinstall_kickstart**
|
||||
(:ref:`scm_dict <scm_support>`) -- If specified, this kickstart file will
|
||||
be copied into each file and pointed to in boot configuration.
|
||||
@ -537,6 +540,13 @@ Example
|
||||
})
|
||||
]
|
||||
|
||||
# Add another repository for lorax to install packages from
|
||||
lorax_extra_sources = [
|
||||
('^Simple$', {
|
||||
'*': 'https://example.com/repo/$basearch/',
|
||||
})
|
||||
]
|
||||
|
||||
|
||||
.. note::
|
||||
|
||||
|
@ -1027,6 +1027,10 @@ def make_schema():
|
||||
"additionalProperties": False,
|
||||
}),
|
||||
|
||||
"lorax_extra_sources": _variant_arch_mapping({
|
||||
"$ref": "#/definitions/strings",
|
||||
}),
|
||||
|
||||
"signing_key_id": {"type": "string"},
|
||||
"signing_key_password_file": {"type": "string"},
|
||||
"signing_command": {"type": "string"},
|
||||
|
@ -95,11 +95,14 @@ class BuildinstallPhase(PhaseBase):
|
||||
log_dir = os.path.join(log_dir, "logs")
|
||||
output_dir = os.path.join(output_dir, "results")
|
||||
|
||||
repos = [repo_baseurl] + get_arch_variant_data(self.compose.conf,
|
||||
'lorax_extra_sources', arch, variant)
|
||||
|
||||
lorax = LoraxWrapper()
|
||||
lorax_cmd = lorax.get_lorax_cmd(self.compose.conf["release_name"],
|
||||
self.compose.conf["release_version"],
|
||||
self.compose.conf["release_version"],
|
||||
repo_baseurl,
|
||||
repos,
|
||||
output_dir,
|
||||
variant=variant.uid,
|
||||
buildinstallpackages=variant.buildinstallpackages,
|
||||
|
@ -113,7 +113,8 @@ class TestBuildinstallPhase(PungiTestCase):
|
||||
# Obtained correct lorax commands.
|
||||
self.assertItemsEqual(
|
||||
loraxCls.return_value.get_lorax_cmd.mock_calls,
|
||||
[mock.call('Test', '1', '1', self.topdir + '/work/x86_64/repo',
|
||||
[mock.call('Test', '1', '1',
|
||||
[self.topdir + '/work/x86_64/repo'],
|
||||
self.topdir + '/work/x86_64/buildinstall/Server',
|
||||
buildarch='x86_64', is_final=True, nomacboot=True, noupgrade=True,
|
||||
volid='vol_id', variant='Server', buildinstallpackages=['bash', 'vim'],
|
||||
@ -121,7 +122,8 @@ class TestBuildinstallPhase(PungiTestCase):
|
||||
add_template=[], add_arch_template=[],
|
||||
add_template_var=[], add_arch_template_var=[],
|
||||
log_dir=self.topdir + '/logs/x86_64/buildinstall-Server-logs'),
|
||||
mock.call('Test', '1', '1', self.topdir + '/work/amd64/repo',
|
||||
mock.call('Test', '1', '1',
|
||||
[self.topdir + '/work/amd64/repo'],
|
||||
self.topdir + '/work/amd64/buildinstall/Server',
|
||||
buildarch='amd64', is_final=True, nomacboot=True, noupgrade=True,
|
||||
volid='vol_id', variant='Server', buildinstallpackages=['bash', 'vim'],
|
||||
@ -129,7 +131,8 @@ class TestBuildinstallPhase(PungiTestCase):
|
||||
add_template=[], add_arch_template=[],
|
||||
add_template_var=[], add_arch_template_var=[],
|
||||
log_dir=self.topdir + '/logs/amd64/buildinstall-Server-logs'),
|
||||
mock.call('Test', '1', '1', self.topdir + '/work/amd64/repo',
|
||||
mock.call('Test', '1', '1',
|
||||
[self.topdir + '/work/amd64/repo'],
|
||||
self.topdir + '/work/amd64/buildinstall/Client',
|
||||
buildarch='amd64', is_final=True, nomacboot=True, noupgrade=True,
|
||||
volid='vol_id', variant='Client', buildinstallpackages=[],
|
||||
@ -173,7 +176,8 @@ class TestBuildinstallPhase(PungiTestCase):
|
||||
# Obtained correct lorax command.
|
||||
lorax = loraxCls.return_value
|
||||
lorax.get_lorax_cmd.assert_has_calls(
|
||||
[mock.call('Test', '1', '1', self.topdir + '/work/amd64/repo',
|
||||
[mock.call('Test', '1', '1',
|
||||
[self.topdir + '/work/amd64/repo'],
|
||||
self.topdir + '/work/amd64/buildinstall/Client',
|
||||
buildarch='amd64', is_final=True, nomacboot=True, noupgrade=True,
|
||||
volid='vol_id', variant='Client', buildinstallpackages=[],
|
||||
@ -272,7 +276,8 @@ class TestBuildinstallPhase(PungiTestCase):
|
||||
# Obtained correct lorax commands.
|
||||
self.assertItemsEqual(
|
||||
loraxCls.return_value.get_lorax_cmd.mock_calls,
|
||||
[mock.call('Test', '1', '1', self.topdir + '/work/x86_64/repo',
|
||||
[mock.call('Test', '1', '1',
|
||||
[self.topdir + '/work/x86_64/repo'],
|
||||
self.topdir + '/work/x86_64/buildinstall/Server',
|
||||
buildarch='x86_64', is_final=True, nomacboot=True, noupgrade=True,
|
||||
volid='vol_id', variant='Server', buildinstallpackages=['bash', 'vim'],
|
||||
@ -280,7 +285,8 @@ class TestBuildinstallPhase(PungiTestCase):
|
||||
add_template_var=['baz=1'], add_arch_template_var=['quux=2'],
|
||||
bugurl='http://example.com',
|
||||
log_dir=self.topdir + '/logs/x86_64/buildinstall-Server-logs'),
|
||||
mock.call('Test', '1', '1', self.topdir + '/work/amd64/repo',
|
||||
mock.call('Test', '1', '1',
|
||||
[self.topdir + '/work/amd64/repo'],
|
||||
self.topdir + '/work/amd64/buildinstall/Server',
|
||||
buildarch='amd64', is_final=True, nomacboot=True, noupgrade=False,
|
||||
volid='vol_id', variant='Server', buildinstallpackages=['bash', 'vim'],
|
||||
@ -288,7 +294,8 @@ class TestBuildinstallPhase(PungiTestCase):
|
||||
add_template=[], add_arch_template=[],
|
||||
add_template_var=[], add_arch_template_var=[],
|
||||
log_dir=self.topdir + '/logs/amd64/buildinstall-Server-logs'),
|
||||
mock.call('Test', '1', '1', self.topdir + '/work/amd64/repo',
|
||||
mock.call('Test', '1', '1',
|
||||
[self.topdir + '/work/amd64/repo'],
|
||||
self.topdir + '/work/amd64/buildinstall/Client',
|
||||
buildarch='amd64', is_final=True, nomacboot=False, noupgrade=True,
|
||||
volid='vol_id', variant='Client', buildinstallpackages=[],
|
||||
@ -341,7 +348,8 @@ class TestBuildinstallPhase(PungiTestCase):
|
||||
# Obtained correct lorax commands.
|
||||
self.assertItemsEqual(
|
||||
loraxCls.return_value.get_lorax_cmd.mock_calls,
|
||||
[mock.call('Test', '1', '1', self.topdir + '/work/x86_64/repo',
|
||||
[mock.call('Test', '1', '1',
|
||||
[self.topdir + '/work/x86_64/repo'],
|
||||
self.topdir + '/work/x86_64/buildinstall/Server',
|
||||
buildarch='x86_64', is_final=True, nomacboot=False, noupgrade=False,
|
||||
volid='vol_id', variant='Server', buildinstallpackages=['bash', 'vim'],
|
||||
@ -349,7 +357,8 @@ class TestBuildinstallPhase(PungiTestCase):
|
||||
add_template=[], add_arch_template=[],
|
||||
add_template_var=[], add_arch_template_var=[],
|
||||
log_dir=self.topdir + '/logs/x86_64/buildinstall-Server-logs'),
|
||||
mock.call('Test', '1', '1', self.topdir + '/work/amd64/repo',
|
||||
mock.call('Test', '1', '1',
|
||||
[self.topdir + '/work/amd64/repo'],
|
||||
self.topdir + '/work/amd64/buildinstall/Server',
|
||||
buildarch='amd64', is_final=True, nomacboot=True, noupgrade=False,
|
||||
volid='vol_id', variant='Server', buildinstallpackages=['bash', 'vim'],
|
||||
@ -357,7 +366,8 @@ class TestBuildinstallPhase(PungiTestCase):
|
||||
add_template=[], add_arch_template=[],
|
||||
add_template_var=[], add_arch_template_var=[],
|
||||
log_dir=self.topdir + '/logs/amd64/buildinstall-Server-logs'),
|
||||
mock.call('Test', '1', '1', self.topdir + '/work/amd64/repo',
|
||||
mock.call('Test', '1', '1',
|
||||
[self.topdir + '/work/amd64/repo'],
|
||||
self.topdir + '/work/amd64/buildinstall/Client',
|
||||
buildarch='amd64', is_final=True, nomacboot=True, noupgrade=False,
|
||||
volid='vol_id', variant='Client', buildinstallpackages=[],
|
||||
@ -410,7 +420,8 @@ class TestBuildinstallPhase(PungiTestCase):
|
||||
# Obtained correct lorax commands.
|
||||
self.assertItemsEqual(
|
||||
loraxCls.return_value.get_lorax_cmd.mock_calls,
|
||||
[mock.call('Test', '1', '1', 'http://localhost/work/x86_64/repo',
|
||||
[mock.call('Test', '1', '1',
|
||||
['http://localhost/work/x86_64/repo'],
|
||||
buildinstall_topdir + '/x86_64/Server/results',
|
||||
buildarch='x86_64', is_final=True, nomacboot=True, noupgrade=True,
|
||||
volid='vol_id', variant='Server', buildinstallpackages=['bash', 'vim'],
|
||||
@ -418,7 +429,8 @@ class TestBuildinstallPhase(PungiTestCase):
|
||||
add_template_var=[], add_arch_template_var=[],
|
||||
bugurl=None,
|
||||
log_dir=buildinstall_topdir + '/x86_64/Server/logs'),
|
||||
mock.call('Test', '1', '1', 'http://localhost/work/amd64/repo',
|
||||
mock.call('Test', '1', '1',
|
||||
['http://localhost/work/amd64/repo'],
|
||||
buildinstall_topdir + '/amd64/Server/results',
|
||||
buildarch='amd64', is_final=True, nomacboot=True, noupgrade=True,
|
||||
volid='vol_id', variant='Server', buildinstallpackages=['bash', 'vim'],
|
||||
@ -426,7 +438,8 @@ class TestBuildinstallPhase(PungiTestCase):
|
||||
add_template=[], add_arch_template=[],
|
||||
add_template_var=[], add_arch_template_var=[],
|
||||
log_dir=buildinstall_topdir + '/amd64/Server/logs'),
|
||||
mock.call('Test', '1', '1', 'http://localhost/work/amd64/repo',
|
||||
mock.call('Test', '1', '1',
|
||||
['http://localhost/work/amd64/repo'],
|
||||
buildinstall_topdir + '/amd64/Client/results',
|
||||
buildarch='amd64', is_final=True, nomacboot=True, noupgrade=True,
|
||||
volid='vol_id', variant='Client', buildinstallpackages=[],
|
||||
@ -440,6 +453,66 @@ class TestBuildinstallPhase(PungiTestCase):
|
||||
mock.call(compose, 'amd64', variant=compose.variants['Client'], disc_type='dvd'),
|
||||
mock.call(compose, 'amd64', variant=compose.variants['Server'], disc_type='dvd')])
|
||||
|
||||
@mock.patch('pungi.phases.buildinstall.ThreadPool')
|
||||
@mock.patch('pungi.phases.buildinstall.LoraxWrapper')
|
||||
@mock.patch('pungi.phases.buildinstall.get_volid')
|
||||
def test_uses_lorax_extra_repos(self, get_volid, loraxCls, poolCls):
|
||||
compose = BuildInstallCompose(self.topdir, {
|
||||
'bootable': True,
|
||||
'release_name': 'Test',
|
||||
'release_short': 't',
|
||||
'release_version': '1',
|
||||
'release_is_layered': False,
|
||||
'buildinstall_method': 'lorax',
|
||||
'lorax_extra_sources': [
|
||||
('^Server$', {
|
||||
'x86_64': "http://example.com/repo1",
|
||||
}),
|
||||
('^Client$', {
|
||||
'*': ["http://example.com/repo2", "http://example.com/repo3"],
|
||||
}),
|
||||
]
|
||||
})
|
||||
|
||||
get_volid.return_value = 'vol_id'
|
||||
loraxCls.return_value.get_lorax_cmd.return_value = ['lorax', '...']
|
||||
|
||||
phase = BuildinstallPhase(compose)
|
||||
|
||||
phase.run()
|
||||
|
||||
self.assertItemsEqual(
|
||||
loraxCls.return_value.get_lorax_cmd.mock_calls,
|
||||
[mock.call('Test', '1', '1',
|
||||
[self.topdir + '/work/x86_64/repo', "http://example.com/repo1"],
|
||||
self.topdir + '/work/x86_64/buildinstall/Server',
|
||||
buildarch='x86_64', is_final=True, nomacboot=True, noupgrade=True,
|
||||
volid='vol_id', variant='Server', buildinstallpackages=['bash', 'vim'],
|
||||
add_template=[], add_arch_template=[],
|
||||
add_template_var=[], add_arch_template_var=[],
|
||||
bugurl=None,
|
||||
log_dir=self.topdir + '/logs/x86_64/buildinstall-Server-logs'),
|
||||
mock.call('Test', '1', '1',
|
||||
[self.topdir + '/work/amd64/repo'],
|
||||
self.topdir + '/work/amd64/buildinstall/Server',
|
||||
buildarch='amd64', is_final=True, nomacboot=True, noupgrade=True,
|
||||
volid='vol_id', variant='Server', buildinstallpackages=['bash', 'vim'],
|
||||
bugurl=None,
|
||||
add_template=[], add_arch_template=[],
|
||||
add_template_var=[], add_arch_template_var=[],
|
||||
log_dir=self.topdir + '/logs/amd64/buildinstall-Server-logs'),
|
||||
mock.call('Test', '1', '1',
|
||||
[self.topdir + '/work/amd64/repo',
|
||||
"http://example.com/repo2",
|
||||
"http://example.com/repo3"],
|
||||
self.topdir + '/work/amd64/buildinstall/Client',
|
||||
buildarch='amd64', is_final=True, nomacboot=True, noupgrade=True,
|
||||
volid='vol_id', variant='Client', buildinstallpackages=[],
|
||||
bugurl=None,
|
||||
add_template=[], add_arch_template=[],
|
||||
add_template_var=[], add_arch_template_var=[],
|
||||
log_dir=self.topdir + '/logs/amd64/buildinstall-Client-logs')])
|
||||
|
||||
|
||||
class TestCopyFiles(PungiTestCase):
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user