live-images: Honor global settings for target
Instead of the old default value and custom handling introduce new option `live_images_target` (for consistency with other phases) and use the usual inheritance rules. Fixes: https://pagure.io/pungi/issue/749 Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
842e2e810e
commit
c89f033457
@ -973,11 +973,12 @@ The kickstart URL is configured by these options.
|
|||||||
* ``image_build_ksurl``
|
* ``image_build_ksurl``
|
||||||
* ``live_images_ksurl``
|
* ``live_images_ksurl``
|
||||||
|
|
||||||
Target is specified by these settings. For live images refer to ``live_target``.
|
Target is specified by these settings.
|
||||||
|
|
||||||
* ``global_target`` -- global fallback setting
|
* ``global_target`` -- global fallback setting
|
||||||
* ``live_media_target``
|
* ``live_media_target``
|
||||||
* ``image_build_target``
|
* ``image_build_target``
|
||||||
|
* ``live_images_target``
|
||||||
|
|
||||||
Version is specified by these options. If no version is set, a default value
|
Version is specified by these options. If no version is set, a default value
|
||||||
will be provided according to :ref:`automatic versioning <auto-version>`.
|
will be provided according to :ref:`automatic versioning <auto-version>`.
|
||||||
@ -1006,10 +1007,6 @@ compose. If the list contains only ``"*"``, all arches will be substituted.
|
|||||||
Live Images Settings
|
Live Images Settings
|
||||||
====================
|
====================
|
||||||
|
|
||||||
**live_target**
|
|
||||||
(*str*) -- Koji build target for which to build the images. This gets
|
|
||||||
passed to ``koji spin-livecd``.
|
|
||||||
|
|
||||||
**live_images**
|
**live_images**
|
||||||
(*list*) -- Configuration for the particular image. The elements of the
|
(*list*) -- Configuration for the particular image. The elements of the
|
||||||
list should be tuples ``(variant_uid_regex, {arch|*: config})``. The config
|
list should be tuples ``(variant_uid_regex, {arch|*: config})``. The config
|
||||||
@ -1019,6 +1016,7 @@ Live Images Settings
|
|||||||
* ``ksurl`` (*str*) [optional] -- where to get the kickstart from
|
* ``ksurl`` (*str*) [optional] -- where to get the kickstart from
|
||||||
* ``name`` (*str*)
|
* ``name`` (*str*)
|
||||||
* ``version`` (*str*)
|
* ``version`` (*str*)
|
||||||
|
* ``target`` (*str*)
|
||||||
* ``repo`` (*str|[str]*) -- repos specified by URL or variant UID
|
* ``repo`` (*str|[str]*) -- repos specified by URL or variant UID
|
||||||
* ``specfile`` (*str*) -- for images wrapped in RPM
|
* ``specfile`` (*str*) -- for images wrapped in RPM
|
||||||
* ``scratch`` (*bool*) -- only RPM-wrapped images can use scratch builds,
|
* ``scratch`` (*bool*) -- only RPM-wrapped images can use scratch builds,
|
||||||
@ -1050,7 +1048,6 @@ Live Media Settings
|
|||||||
|
|
||||||
* ``name`` (*str*)
|
* ``name`` (*str*)
|
||||||
* ``version`` (*str*)
|
* ``version`` (*str*)
|
||||||
* ``target`` (*str*)
|
|
||||||
* ``arches`` (*[str]*) -- what architectures to build the media for; by default uses
|
* ``arches`` (*[str]*) -- what architectures to build the media for; by default uses
|
||||||
all arches for the variant.
|
all arches for the variant.
|
||||||
* ``kickstart`` (*str*) -- name of the kickstart file
|
* ``kickstart`` (*str*) -- name of the kickstart file
|
||||||
@ -1060,6 +1057,7 @@ Live Media Settings
|
|||||||
* ``ksurl`` (*str*)
|
* ``ksurl`` (*str*)
|
||||||
* ``ksversion`` (*str*)
|
* ``ksversion`` (*str*)
|
||||||
* ``scratch`` (*bool*)
|
* ``scratch`` (*bool*)
|
||||||
|
* ``target`` (*str*)
|
||||||
* ``release`` (*str*) -- a string with the release, or
|
* ``release`` (*str*) -- a string with the release, or
|
||||||
``!RELEASE_FROM_LABEL_DATE_TYPE_RESPIN`` to automatically generate a
|
``!RELEASE_FROM_LABEL_DATE_TYPE_RESPIN`` to automatically generate a
|
||||||
suitable value. See :ref:`automatic versioning <auto-version>` for
|
suitable value. See :ref:`automatic versioning <auto-version>` for
|
||||||
|
@ -462,6 +462,7 @@ def make_schema():
|
|||||||
"ksurl": {"type": "string"},
|
"ksurl": {"type": "string"},
|
||||||
"name": {"type": "string"},
|
"name": {"type": "string"},
|
||||||
"subvariant": {"type": "string"},
|
"subvariant": {"type": "string"},
|
||||||
|
"target": {"type": "string"},
|
||||||
"version": {"type": "string"},
|
"version": {"type": "string"},
|
||||||
"repo": {
|
"repo": {
|
||||||
"$ref": "#/definitions/repos",
|
"$ref": "#/definitions/repos",
|
||||||
@ -759,6 +760,7 @@ def make_schema():
|
|||||||
"default": False,
|
"default": False,
|
||||||
},
|
},
|
||||||
"live_images_ksurl": {"type": "string"},
|
"live_images_ksurl": {"type": "string"},
|
||||||
|
"live_images_target": {"type": "string"},
|
||||||
"live_images_release": {"$ref": "#/definitions/optional_string"},
|
"live_images_release": {"$ref": "#/definitions/optional_string"},
|
||||||
"live_images_version": {"type": "string"},
|
"live_images_version": {"type": "string"},
|
||||||
|
|
||||||
@ -805,10 +807,8 @@ def make_schema():
|
|||||||
"default": False
|
"default": False
|
||||||
},
|
},
|
||||||
|
|
||||||
"live_target": {
|
# Deprecated in favour of regular local/phase/global setting.
|
||||||
"type": "string",
|
"live_target": {"type": "string"},
|
||||||
"default": "rhel-7.0-candidate",
|
|
||||||
},
|
|
||||||
|
|
||||||
"tree_arches": {
|
"tree_arches": {
|
||||||
"$ref": "#/definitions/list_of_strings",
|
"$ref": "#/definitions/list_of_strings",
|
||||||
|
@ -92,6 +92,9 @@ class LiveImagesPhase(base.PhaseLoggerMixin, base.ImageConfigMixin, base.ConfigG
|
|||||||
"label": "", # currently not used
|
"label": "", # currently not used
|
||||||
"subvariant": subvariant,
|
"subvariant": subvariant,
|
||||||
"failable_arches": data.get('failable', []),
|
"failable_arches": data.get('failable', []),
|
||||||
|
# First see if live_target is specified, then fall back
|
||||||
|
# to regular setup of local, phase and global setting.
|
||||||
|
"target": self.compose.conf.get('live_target') or self.get_config(data, 'target'),
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd["repos"] = self._get_repos(arch, variant, data)
|
cmd["repos"] = self._get_repos(arch, variant, data)
|
||||||
@ -161,8 +164,8 @@ class CreateLiveImageThread(WorkerThread):
|
|||||||
if cmd["specfile"] and not cmd["scratch"]:
|
if cmd["specfile"] and not cmd["scratch"]:
|
||||||
# Non scratch build are allowed only for rpm wrapped images
|
# Non scratch build are allowed only for rpm wrapped images
|
||||||
archive = True
|
archive = True
|
||||||
target = compose.conf["live_target"]
|
koji_cmd = koji_wrapper.get_create_image_cmd(name, version,
|
||||||
koji_cmd = koji_wrapper.get_create_image_cmd(name, version, target,
|
cmd["target"],
|
||||||
cmd["build_arch"],
|
cmd["build_arch"],
|
||||||
cmd["ks_file"],
|
cmd["ks_file"],
|
||||||
cmd["repos"],
|
cmd["repos"],
|
||||||
|
@ -25,6 +25,7 @@ class TestLiveImagesPhase(PungiTestCase):
|
|||||||
'kickstart': 'test.ks',
|
'kickstart': 'test.ks',
|
||||||
'repo': ['http://example.com/repo/', 'Everything', 'Server-optional'],
|
'repo': ['http://example.com/repo/', 'Everything', 'Server-optional'],
|
||||||
'release': None,
|
'release': None,
|
||||||
|
'target': 'f27',
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
@ -60,7 +61,8 @@ class TestLiveImagesPhase(PungiTestCase):
|
|||||||
'release': '20151203.t.0',
|
'release': '20151203.t.0',
|
||||||
'subvariant': 'Client',
|
'subvariant': 'Client',
|
||||||
'failable_arches': [],
|
'failable_arches': [],
|
||||||
'ksurl': None},
|
'ksurl': None,
|
||||||
|
'target': 'f27'},
|
||||||
compose.variants['Client'],
|
compose.variants['Client'],
|
||||||
'amd64'))])
|
'amd64'))])
|
||||||
self.assertItemsEqual(
|
self.assertItemsEqual(
|
||||||
@ -77,6 +79,7 @@ class TestLiveImagesPhase(PungiTestCase):
|
|||||||
'kickstart': 'test.ks',
|
'kickstart': 'test.ks',
|
||||||
'repo': ['http://example.com/repo/', 'Everything'],
|
'repo': ['http://example.com/repo/', 'Everything'],
|
||||||
'release': None,
|
'release': None,
|
||||||
|
'target': 'f27',
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
@ -110,7 +113,8 @@ class TestLiveImagesPhase(PungiTestCase):
|
|||||||
'release': '20151203.t.0',
|
'release': '20151203.t.0',
|
||||||
'subvariant': 'Client',
|
'subvariant': 'Client',
|
||||||
'failable_arches': [],
|
'failable_arches': [],
|
||||||
'ksurl': None},
|
'ksurl': None,
|
||||||
|
'target': 'f27'},
|
||||||
compose.variants['Client'],
|
compose.variants['Client'],
|
||||||
'amd64'))])
|
'amd64'))])
|
||||||
|
|
||||||
@ -124,6 +128,7 @@ class TestLiveImagesPhase(PungiTestCase):
|
|||||||
'kickstart': 'test.ks',
|
'kickstart': 'test.ks',
|
||||||
'repo': ['http://example.com/repo/', 'Everything'],
|
'repo': ['http://example.com/repo/', 'Everything'],
|
||||||
'release': None,
|
'release': None,
|
||||||
|
'target': 'f27',
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
@ -157,7 +162,8 @@ class TestLiveImagesPhase(PungiTestCase):
|
|||||||
'release': '20151203.t.0',
|
'release': '20151203.t.0',
|
||||||
'subvariant': 'Client',
|
'subvariant': 'Client',
|
||||||
'failable_arches': [],
|
'failable_arches': [],
|
||||||
'ksurl': None},
|
'ksurl': None,
|
||||||
|
'target': 'f27'},
|
||||||
compose.variants['Client'],
|
compose.variants['Client'],
|
||||||
'amd64'))])
|
'amd64'))])
|
||||||
|
|
||||||
@ -169,9 +175,11 @@ class TestLiveImagesPhase(PungiTestCase):
|
|||||||
'amd64': [{
|
'amd64': [{
|
||||||
'kickstart': 'test.ks',
|
'kickstart': 'test.ks',
|
||||||
'repo': ['http://example.com/repo/', 'Everything'],
|
'repo': ['http://example.com/repo/', 'Everything'],
|
||||||
|
'target': 'f27',
|
||||||
}, {
|
}, {
|
||||||
'kickstart': 'another.ks',
|
'kickstart': 'another.ks',
|
||||||
'repo': ['http://example.com/repo/', 'Everything'],
|
'repo': ['http://example.com/repo/', 'Everything'],
|
||||||
|
'target': 'f27',
|
||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
@ -205,6 +213,7 @@ class TestLiveImagesPhase(PungiTestCase):
|
|||||||
'release': None,
|
'release': None,
|
||||||
'subvariant': 'Client',
|
'subvariant': 'Client',
|
||||||
'failable_arches': [],
|
'failable_arches': [],
|
||||||
|
'target': 'f27',
|
||||||
'ksurl': None},
|
'ksurl': None},
|
||||||
compose.variants['Client'],
|
compose.variants['Client'],
|
||||||
'amd64')),
|
'amd64')),
|
||||||
@ -226,6 +235,7 @@ class TestLiveImagesPhase(PungiTestCase):
|
|||||||
'release': None,
|
'release': None,
|
||||||
'subvariant': 'Client',
|
'subvariant': 'Client',
|
||||||
'failable_arches': [],
|
'failable_arches': [],
|
||||||
|
'target': 'f27',
|
||||||
'ksurl': None},
|
'ksurl': None},
|
||||||
compose.variants['Client'],
|
compose.variants['Client'],
|
||||||
'amd64'))])
|
'amd64'))])
|
||||||
@ -241,6 +251,7 @@ class TestLiveImagesPhase(PungiTestCase):
|
|||||||
'ksurl': 'https://git.example.com/kickstarts.git?#HEAD',
|
'ksurl': 'https://git.example.com/kickstarts.git?#HEAD',
|
||||||
'repo': ['http://example.com/repo/', 'Everything'],
|
'repo': ['http://example.com/repo/', 'Everything'],
|
||||||
'type': 'appliance',
|
'type': 'appliance',
|
||||||
|
'target': 'f27',
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
@ -276,6 +287,7 @@ class TestLiveImagesPhase(PungiTestCase):
|
|||||||
'release': None,
|
'release': None,
|
||||||
'subvariant': 'Client',
|
'subvariant': 'Client',
|
||||||
'failable_arches': [],
|
'failable_arches': [],
|
||||||
|
'target': 'f27',
|
||||||
'ksurl': 'https://git.example.com/kickstarts.git?#CAFEBABE'},
|
'ksurl': 'https://git.example.com/kickstarts.git?#CAFEBABE'},
|
||||||
compose.variants['Client'],
|
compose.variants['Client'],
|
||||||
'amd64'))])
|
'amd64'))])
|
||||||
@ -289,6 +301,7 @@ class TestLiveImagesPhase(PungiTestCase):
|
|||||||
'live_images_ksurl': 'https://git.example.com/kickstarts.git?#HEAD',
|
'live_images_ksurl': 'https://git.example.com/kickstarts.git?#HEAD',
|
||||||
'live_images_release': None,
|
'live_images_release': None,
|
||||||
'live_images_version': 'Rawhide',
|
'live_images_version': 'Rawhide',
|
||||||
|
'live_images_target': 'f27',
|
||||||
'live_images': [
|
'live_images': [
|
||||||
('^Client$', {
|
('^Client$', {
|
||||||
'amd64': {
|
'amd64': {
|
||||||
@ -330,6 +343,7 @@ class TestLiveImagesPhase(PungiTestCase):
|
|||||||
'release': '20151203.t.0',
|
'release': '20151203.t.0',
|
||||||
'subvariant': 'Client',
|
'subvariant': 'Client',
|
||||||
'failable_arches': [],
|
'failable_arches': [],
|
||||||
|
'target': 'f27',
|
||||||
'ksurl': 'https://git.example.com/kickstarts.git?#CAFEBABE'},
|
'ksurl': 'https://git.example.com/kickstarts.git?#CAFEBABE'},
|
||||||
compose.variants['Client'],
|
compose.variants['Client'],
|
||||||
'amd64'))])
|
'amd64'))])
|
||||||
@ -343,6 +357,7 @@ class TestLiveImagesPhase(PungiTestCase):
|
|||||||
'global_ksurl': 'https://git.example.com/kickstarts.git?#HEAD',
|
'global_ksurl': 'https://git.example.com/kickstarts.git?#HEAD',
|
||||||
'global_release': None,
|
'global_release': None,
|
||||||
'global_version': 'Rawhide',
|
'global_version': 'Rawhide',
|
||||||
|
'global_target': 'f27',
|
||||||
'live_images': [
|
'live_images': [
|
||||||
('^Client$', {
|
('^Client$', {
|
||||||
'amd64': {
|
'amd64': {
|
||||||
@ -384,6 +399,7 @@ class TestLiveImagesPhase(PungiTestCase):
|
|||||||
'release': '20151203.t.0',
|
'release': '20151203.t.0',
|
||||||
'subvariant': 'Client',
|
'subvariant': 'Client',
|
||||||
'failable_arches': [],
|
'failable_arches': [],
|
||||||
|
'target': 'f27',
|
||||||
'ksurl': 'https://git.example.com/kickstarts.git?#CAFEBABE'},
|
'ksurl': 'https://git.example.com/kickstarts.git?#CAFEBABE'},
|
||||||
compose.variants['Client'],
|
compose.variants['Client'],
|
||||||
'amd64'))])
|
'amd64'))])
|
||||||
@ -400,6 +416,7 @@ class TestLiveImagesPhase(PungiTestCase):
|
|||||||
'kickstart': 'test.ks',
|
'kickstart': 'test.ks',
|
||||||
'repo': ['http://example.com/repo/', 'Everything'],
|
'repo': ['http://example.com/repo/', 'Everything'],
|
||||||
'release': None,
|
'release': None,
|
||||||
|
'target': 'f27',
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
@ -433,6 +450,7 @@ class TestLiveImagesPhase(PungiTestCase):
|
|||||||
'release': '20151203.t.0',
|
'release': '20151203.t.0',
|
||||||
'subvariant': 'Client',
|
'subvariant': 'Client',
|
||||||
'failable_arches': [],
|
'failable_arches': [],
|
||||||
|
'target': 'f27',
|
||||||
'ksurl': None},
|
'ksurl': None},
|
||||||
compose.variants['Client'],
|
compose.variants['Client'],
|
||||||
'amd64'))])
|
'amd64'))])
|
||||||
@ -468,6 +486,7 @@ class TestCreateLiveImageThread(PungiTestCase):
|
|||||||
'ksurl': 'https://git.example.com/kickstarts.git?#CAFEBABE',
|
'ksurl': 'https://git.example.com/kickstarts.git?#CAFEBABE',
|
||||||
'release': None,
|
'release': None,
|
||||||
'subvariant': 'Something',
|
'subvariant': 'Something',
|
||||||
|
'target': 'f27',
|
||||||
}
|
}
|
||||||
|
|
||||||
koji_wrapper = KojiWrapper.return_value
|
koji_wrapper = KojiWrapper.return_value
|
||||||
@ -500,7 +519,7 @@ class TestCreateLiveImageThread(PungiTestCase):
|
|||||||
])
|
])
|
||||||
self.assertEqual(run.mock_calls, [mock.call(write_manifest_cmd)])
|
self.assertEqual(run.mock_calls, [mock.call(write_manifest_cmd)])
|
||||||
self.assertEqual(koji_wrapper.get_create_image_cmd.mock_calls,
|
self.assertEqual(koji_wrapper.get_create_image_cmd.mock_calls,
|
||||||
[mock.call('test-Something-Live-amd64', '20151203.0.t', 'rhel-7.0-candidate',
|
[mock.call('test-Something-Live-amd64', '20151203.0.t', 'f27',
|
||||||
'amd64', '/path/to/ks_file',
|
'amd64', '/path/to/ks_file',
|
||||||
['/repo/amd64/Client',
|
['/repo/amd64/Client',
|
||||||
'http://example.com/repo/',
|
'http://example.com/repo/',
|
||||||
@ -547,6 +566,7 @@ class TestCreateLiveImageThread(PungiTestCase):
|
|||||||
'ksurl': 'https://git.example.com/kickstarts.git?#CAFEBABE',
|
'ksurl': 'https://git.example.com/kickstarts.git?#CAFEBABE',
|
||||||
'release': None,
|
'release': None,
|
||||||
'subvariant': 'Client',
|
'subvariant': 'Client',
|
||||||
|
'target': 'f27',
|
||||||
}
|
}
|
||||||
|
|
||||||
koji_wrapper = KojiWrapper.return_value
|
koji_wrapper = KojiWrapper.return_value
|
||||||
@ -579,7 +599,7 @@ class TestCreateLiveImageThread(PungiTestCase):
|
|||||||
])
|
])
|
||||||
self.assertEqual(run.mock_calls, [mock.call(write_manifest_cmd)])
|
self.assertEqual(run.mock_calls, [mock.call(write_manifest_cmd)])
|
||||||
self.assertEqual(koji_wrapper.get_create_image_cmd.mock_calls,
|
self.assertEqual(koji_wrapper.get_create_image_cmd.mock_calls,
|
||||||
[mock.call('test-Client-Live-amd64', '20151203.0.t', 'rhel-7.0-candidate',
|
[mock.call('test-Client-Live-amd64', '20151203.0.t', 'f27',
|
||||||
'amd64', '/path/to/ks_file',
|
'amd64', '/path/to/ks_file',
|
||||||
['/repo/amd64/Client',
|
['/repo/amd64/Client',
|
||||||
'http://example.com/repo/',
|
'http://example.com/repo/',
|
||||||
@ -627,6 +647,7 @@ class TestCreateLiveImageThread(PungiTestCase):
|
|||||||
'ksurl': None,
|
'ksurl': None,
|
||||||
'release': None,
|
'release': None,
|
||||||
'subvariant': 'Client',
|
'subvariant': 'Client',
|
||||||
|
'target': 'f27',
|
||||||
}
|
}
|
||||||
|
|
||||||
koji_wrapper = KojiWrapper.return_value
|
koji_wrapper = KojiWrapper.return_value
|
||||||
@ -655,7 +676,7 @@ class TestCreateLiveImageThread(PungiTestCase):
|
|||||||
|
|
||||||
self.assertEqual(run.mock_calls, [])
|
self.assertEqual(run.mock_calls, [])
|
||||||
self.assertEqual(koji_wrapper.get_create_image_cmd.mock_calls,
|
self.assertEqual(koji_wrapper.get_create_image_cmd.mock_calls,
|
||||||
[mock.call('test-Client-Disk-amd64', '20151203.0.t', 'rhel-7.0-candidate',
|
[mock.call('test-Client-Disk-amd64', '20151203.0.t', 'f27',
|
||||||
'amd64', '/path/to/ks_file',
|
'amd64', '/path/to/ks_file',
|
||||||
['/repo/amd64/Client',
|
['/repo/amd64/Client',
|
||||||
'http://example.com/repo/',
|
'http://example.com/repo/',
|
||||||
@ -703,6 +724,7 @@ class TestCreateLiveImageThread(PungiTestCase):
|
|||||||
'release': 'xyz',
|
'release': 'xyz',
|
||||||
'type': 'live',
|
'type': 'live',
|
||||||
'failable_arches': ['*'],
|
'failable_arches': ['*'],
|
||||||
|
'target': 'f27',
|
||||||
}
|
}
|
||||||
|
|
||||||
koji_wrapper = KojiWrapper.return_value
|
koji_wrapper = KojiWrapper.return_value
|
||||||
@ -747,6 +769,7 @@ class TestCreateLiveImageThread(PungiTestCase):
|
|||||||
'release': 'xyz',
|
'release': 'xyz',
|
||||||
'type': 'live',
|
'type': 'live',
|
||||||
'failable_arches': ['*'],
|
'failable_arches': ['*'],
|
||||||
|
'target': 'f27',
|
||||||
}
|
}
|
||||||
|
|
||||||
koji_wrapper = KojiWrapper.return_value
|
koji_wrapper = KojiWrapper.return_value
|
||||||
|
Loading…
Reference in New Issue
Block a user