Automatically generate missing image version
If the configuration does not specify version for images or live media, Pungi will create a default value based on `release_version`. If label is used for the compose, the milestone from it will be appended to the version (unless it's RC). This change is backwards compatible: nothing changes when version is set in configuration. If the version was missing before, building the artifacts would fail. With this patch, default values will be supplied. Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
5534fda192
commit
223a015898
11 changed files with 141 additions and 16 deletions
|
|
@ -163,6 +163,65 @@ class TestImageBuildPhase(PungiTestCase):
|
|||
self.assertItemsEqual(phase.pool.queue_put.mock_calls,
|
||||
[mock.call((compose, server_args))])
|
||||
|
||||
@mock.patch('pungi.phases.image_build.ThreadPool')
|
||||
def test_image_build_phase_missing_version(self, ThreadPool):
|
||||
compose = DummyCompose(self.topdir, {
|
||||
'image_build_ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
||||
'image_build_release': None,
|
||||
'image_build_target': 'f24',
|
||||
'image_build': {
|
||||
'^Server$': [
|
||||
{
|
||||
'image-build': {
|
||||
'format': [('docker', 'tar.xz')],
|
||||
'name': 'Fedora-Docker-Base',
|
||||
'kickstart': "fedora-docker-base.ks",
|
||||
'distro': 'Fedora-20',
|
||||
'disk_size': 3
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
'koji_profile': 'koji',
|
||||
})
|
||||
|
||||
phase = ImageBuildPhase(compose)
|
||||
|
||||
phase.run()
|
||||
self.maxDiff = None
|
||||
|
||||
# assert at least one thread was started
|
||||
self.assertTrue(phase.pool.add.called)
|
||||
server_args = {
|
||||
"format": [('docker', 'tar.xz')],
|
||||
"image_conf": {
|
||||
'image-build': {
|
||||
'install_tree': self.topdir + '/compose/Server/$arch/os',
|
||||
'kickstart': 'fedora-docker-base.ks',
|
||||
'format': 'docker',
|
||||
'repo': self.topdir + '/compose/Server/$arch/os',
|
||||
'variant': compose.variants['Server'],
|
||||
'target': 'f24',
|
||||
'disk_size': 3,
|
||||
'name': 'Fedora-Docker-Base',
|
||||
'arches': 'amd64,x86_64',
|
||||
'version': '25',
|
||||
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
||||
'distro': 'Fedora-20',
|
||||
'release': '20151203.t.0',
|
||||
}
|
||||
},
|
||||
"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,
|
||||
"failable_arches": [],
|
||||
}
|
||||
self.maxDiff = None
|
||||
self.assertItemsEqual(phase.pool.queue_put.mock_calls,
|
||||
[mock.call((compose, server_args))])
|
||||
|
||||
@mock.patch('pungi.phases.image_build.ThreadPool')
|
||||
def test_image_build_filter_all_variants(self, ThreadPool):
|
||||
compose = DummyCompose(self.topdir, {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue