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`` | ||||
|  * ``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 | ||||
|  * ``live_media_target`` | ||||
|  * ``image_build_target`` | ||||
|  * ``live_images_target`` | ||||
| 
 | ||||
| Version is specified by these options. If no version is set, a default value | ||||
| 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_target** | ||||
|     (*str*) -- Koji build target for which to build the images. This gets | ||||
|     passed to ``koji spin-livecd``. | ||||
| 
 | ||||
| **live_images** | ||||
|     (*list*) -- Configuration for the particular image. The elements of the | ||||
|     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 | ||||
|       * ``name`` (*str*) | ||||
|       * ``version`` (*str*) | ||||
|       * ``target`` (*str*) | ||||
|       * ``repo`` (*str|[str]*) -- repos specified by URL or variant UID | ||||
|       * ``specfile`` (*str*) -- for images wrapped in RPM | ||||
|       * ``scratch`` (*bool*) -- only RPM-wrapped images can use scratch builds, | ||||
| @ -1050,7 +1048,6 @@ Live Media Settings | ||||
| 
 | ||||
|       * ``name`` (*str*) | ||||
|       * ``version`` (*str*) | ||||
|       * ``target`` (*str*) | ||||
|       * ``arches`` (*[str]*) -- what architectures to build the media for; by default uses | ||||
|         all arches for the variant. | ||||
|       * ``kickstart`` (*str*) -- name of the kickstart file | ||||
| @ -1060,6 +1057,7 @@ Live Media Settings | ||||
|       * ``ksurl`` (*str*) | ||||
|       * ``ksversion`` (*str*) | ||||
|       * ``scratch`` (*bool*) | ||||
|       * ``target`` (*str*) | ||||
|       * ``release`` (*str*) -- a string with the release, or | ||||
|         ``!RELEASE_FROM_LABEL_DATE_TYPE_RESPIN`` to automatically generate a | ||||
|         suitable value. See :ref:`automatic versioning <auto-version>` for | ||||
|  | ||||
| @ -462,6 +462,7 @@ def make_schema(): | ||||
|                     "ksurl": {"type": "string"}, | ||||
|                     "name": {"type": "string"}, | ||||
|                     "subvariant": {"type": "string"}, | ||||
|                     "target": {"type": "string"}, | ||||
|                     "version": {"type": "string"}, | ||||
|                     "repo": { | ||||
|                         "$ref": "#/definitions/repos", | ||||
| @ -759,6 +760,7 @@ def make_schema(): | ||||
|                 "default": False, | ||||
|             }, | ||||
|             "live_images_ksurl": {"type": "string"}, | ||||
|             "live_images_target": {"type": "string"}, | ||||
|             "live_images_release": {"$ref": "#/definitions/optional_string"}, | ||||
|             "live_images_version": {"type": "string"}, | ||||
| 
 | ||||
| @ -805,10 +807,8 @@ def make_schema(): | ||||
|                 "default": False | ||||
|             }, | ||||
| 
 | ||||
|             "live_target": { | ||||
|                 "type": "string", | ||||
|                 "default": "rhel-7.0-candidate", | ||||
|             }, | ||||
|             # Deprecated in favour of regular local/phase/global setting. | ||||
|             "live_target": {"type": "string"}, | ||||
| 
 | ||||
|             "tree_arches": { | ||||
|                 "$ref": "#/definitions/list_of_strings", | ||||
|  | ||||
| @ -92,6 +92,9 @@ class LiveImagesPhase(base.PhaseLoggerMixin, base.ImageConfigMixin, base.ConfigG | ||||
|                         "label": "",  # currently not used | ||||
|                         "subvariant": subvariant, | ||||
|                         "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) | ||||
| @ -161,8 +164,8 @@ class CreateLiveImageThread(WorkerThread): | ||||
|         if cmd["specfile"] and not cmd["scratch"]: | ||||
|             # Non scratch build are allowed only for rpm wrapped images | ||||
|             archive = True | ||||
|         target = compose.conf["live_target"] | ||||
|         koji_cmd = koji_wrapper.get_create_image_cmd(name, version, target, | ||||
|         koji_cmd = koji_wrapper.get_create_image_cmd(name, version, | ||||
|                                                      cmd["target"], | ||||
|                                                      cmd["build_arch"], | ||||
|                                                      cmd["ks_file"], | ||||
|                                                      cmd["repos"], | ||||
|  | ||||
| @ -25,6 +25,7 @@ class TestLiveImagesPhase(PungiTestCase): | ||||
|                         'kickstart': 'test.ks', | ||||
|                         'repo': ['http://example.com/repo/', 'Everything', 'Server-optional'], | ||||
|                         'release': None, | ||||
|                         'target': 'f27', | ||||
|                     } | ||||
|                 }) | ||||
|             ], | ||||
| @ -60,7 +61,8 @@ class TestLiveImagesPhase(PungiTestCase): | ||||
|                                            'release': '20151203.t.0', | ||||
|                                            'subvariant': 'Client', | ||||
|                                            'failable_arches': [], | ||||
|                                            'ksurl': None}, | ||||
|                                            'ksurl': None, | ||||
|                                            'target': 'f27'}, | ||||
|                                           compose.variants['Client'], | ||||
|                                           'amd64'))]) | ||||
|         self.assertItemsEqual( | ||||
| @ -77,6 +79,7 @@ class TestLiveImagesPhase(PungiTestCase): | ||||
|                         'kickstart': 'test.ks', | ||||
|                         'repo': ['http://example.com/repo/', 'Everything'], | ||||
|                         'release': None, | ||||
|                         'target': 'f27', | ||||
|                     } | ||||
|                 }) | ||||
|             ], | ||||
| @ -110,7 +113,8 @@ class TestLiveImagesPhase(PungiTestCase): | ||||
|                                            'release': '20151203.t.0', | ||||
|                                            'subvariant': 'Client', | ||||
|                                            'failable_arches': [], | ||||
|                                            'ksurl': None}, | ||||
|                                            'ksurl': None, | ||||
|                                            'target': 'f27'}, | ||||
|                                           compose.variants['Client'], | ||||
|                                           'amd64'))]) | ||||
| 
 | ||||
| @ -124,6 +128,7 @@ class TestLiveImagesPhase(PungiTestCase): | ||||
|                         'kickstart': 'test.ks', | ||||
|                         'repo': ['http://example.com/repo/', 'Everything'], | ||||
|                         'release': None, | ||||
|                         'target': 'f27', | ||||
|                     } | ||||
|                 }) | ||||
|             ], | ||||
| @ -157,7 +162,8 @@ class TestLiveImagesPhase(PungiTestCase): | ||||
|                                            'release': '20151203.t.0', | ||||
|                                            'subvariant': 'Client', | ||||
|                                            'failable_arches': [], | ||||
|                                            'ksurl': None}, | ||||
|                                            'ksurl': None, | ||||
|                                            'target': 'f27'}, | ||||
|                                           compose.variants['Client'], | ||||
|                                           'amd64'))]) | ||||
| 
 | ||||
| @ -169,9 +175,11 @@ class TestLiveImagesPhase(PungiTestCase): | ||||
|                     'amd64': [{ | ||||
|                         'kickstart': 'test.ks', | ||||
|                         'repo': ['http://example.com/repo/', 'Everything'], | ||||
|                         'target': 'f27', | ||||
|                     }, { | ||||
|                         'kickstart': 'another.ks', | ||||
|                         'repo': ['http://example.com/repo/', 'Everything'], | ||||
|                         'target': 'f27', | ||||
|                     }] | ||||
|                 }) | ||||
|             ], | ||||
| @ -205,6 +213,7 @@ class TestLiveImagesPhase(PungiTestCase): | ||||
|                                            'release': None, | ||||
|                                            'subvariant': 'Client', | ||||
|                                            'failable_arches': [], | ||||
|                                            'target': 'f27', | ||||
|                                            'ksurl': None}, | ||||
|                                           compose.variants['Client'], | ||||
|                                           'amd64')), | ||||
| @ -226,6 +235,7 @@ class TestLiveImagesPhase(PungiTestCase): | ||||
|                                            'release': None, | ||||
|                                            'subvariant': 'Client', | ||||
|                                            'failable_arches': [], | ||||
|                                            'target': 'f27', | ||||
|                                            'ksurl': None}, | ||||
|                                           compose.variants['Client'], | ||||
|                                           'amd64'))]) | ||||
| @ -241,6 +251,7 @@ class TestLiveImagesPhase(PungiTestCase): | ||||
|                         'ksurl': 'https://git.example.com/kickstarts.git?#HEAD', | ||||
|                         'repo': ['http://example.com/repo/', 'Everything'], | ||||
|                         'type': 'appliance', | ||||
|                         'target': 'f27', | ||||
|                     } | ||||
|                 }) | ||||
|             ], | ||||
| @ -276,6 +287,7 @@ class TestLiveImagesPhase(PungiTestCase): | ||||
|                                            'release': None, | ||||
|                                            'subvariant': 'Client', | ||||
|                                            'failable_arches': [], | ||||
|                                            'target': 'f27', | ||||
|                                            'ksurl': 'https://git.example.com/kickstarts.git?#CAFEBABE'}, | ||||
|                                           compose.variants['Client'], | ||||
|                                           'amd64'))]) | ||||
| @ -289,6 +301,7 @@ class TestLiveImagesPhase(PungiTestCase): | ||||
|             'live_images_ksurl': 'https://git.example.com/kickstarts.git?#HEAD', | ||||
|             'live_images_release': None, | ||||
|             'live_images_version': 'Rawhide', | ||||
|             'live_images_target': 'f27', | ||||
|             'live_images': [ | ||||
|                 ('^Client$', { | ||||
|                     'amd64': { | ||||
| @ -330,6 +343,7 @@ class TestLiveImagesPhase(PungiTestCase): | ||||
|                                            'release': '20151203.t.0', | ||||
|                                            'subvariant': 'Client', | ||||
|                                            'failable_arches': [], | ||||
|                                            'target': 'f27', | ||||
|                                            'ksurl': 'https://git.example.com/kickstarts.git?#CAFEBABE'}, | ||||
|                                           compose.variants['Client'], | ||||
|                                           'amd64'))]) | ||||
| @ -343,6 +357,7 @@ class TestLiveImagesPhase(PungiTestCase): | ||||
|             'global_ksurl': 'https://git.example.com/kickstarts.git?#HEAD', | ||||
|             'global_release': None, | ||||
|             'global_version': 'Rawhide', | ||||
|             'global_target': 'f27', | ||||
|             'live_images': [ | ||||
|                 ('^Client$', { | ||||
|                     'amd64': { | ||||
| @ -384,6 +399,7 @@ class TestLiveImagesPhase(PungiTestCase): | ||||
|                                            'release': '20151203.t.0', | ||||
|                                            'subvariant': 'Client', | ||||
|                                            'failable_arches': [], | ||||
|                                            'target': 'f27', | ||||
|                                            'ksurl': 'https://git.example.com/kickstarts.git?#CAFEBABE'}, | ||||
|                                           compose.variants['Client'], | ||||
|                                           'amd64'))]) | ||||
| @ -400,6 +416,7 @@ class TestLiveImagesPhase(PungiTestCase): | ||||
|                         'kickstart': 'test.ks', | ||||
|                         'repo': ['http://example.com/repo/', 'Everything'], | ||||
|                         'release': None, | ||||
|                         'target': 'f27', | ||||
|                     } | ||||
|                 }) | ||||
|             ], | ||||
| @ -433,6 +450,7 @@ class TestLiveImagesPhase(PungiTestCase): | ||||
|                                            'release': '20151203.t.0', | ||||
|                                            'subvariant': 'Client', | ||||
|                                            'failable_arches': [], | ||||
|                                            'target': 'f27', | ||||
|                                            'ksurl': None}, | ||||
|                                           compose.variants['Client'], | ||||
|                                           'amd64'))]) | ||||
| @ -468,6 +486,7 @@ class TestCreateLiveImageThread(PungiTestCase): | ||||
|             'ksurl': 'https://git.example.com/kickstarts.git?#CAFEBABE', | ||||
|             'release': None, | ||||
|             'subvariant': 'Something', | ||||
|             'target': 'f27', | ||||
|         } | ||||
| 
 | ||||
|         koji_wrapper = KojiWrapper.return_value | ||||
| @ -500,7 +519,7 @@ class TestCreateLiveImageThread(PungiTestCase): | ||||
|         ]) | ||||
|         self.assertEqual(run.mock_calls, [mock.call(write_manifest_cmd)]) | ||||
|         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', | ||||
|                                     ['/repo/amd64/Client', | ||||
|                                      'http://example.com/repo/', | ||||
| @ -547,6 +566,7 @@ class TestCreateLiveImageThread(PungiTestCase): | ||||
|             'ksurl': 'https://git.example.com/kickstarts.git?#CAFEBABE', | ||||
|             'release': None, | ||||
|             'subvariant': 'Client', | ||||
|             'target': 'f27', | ||||
|         } | ||||
| 
 | ||||
|         koji_wrapper = KojiWrapper.return_value | ||||
| @ -579,7 +599,7 @@ class TestCreateLiveImageThread(PungiTestCase): | ||||
|         ]) | ||||
|         self.assertEqual(run.mock_calls, [mock.call(write_manifest_cmd)]) | ||||
|         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', | ||||
|                                     ['/repo/amd64/Client', | ||||
|                                      'http://example.com/repo/', | ||||
| @ -627,6 +647,7 @@ class TestCreateLiveImageThread(PungiTestCase): | ||||
|             'ksurl': None, | ||||
|             'release': None, | ||||
|             'subvariant': 'Client', | ||||
|             'target': 'f27', | ||||
|         } | ||||
| 
 | ||||
|         koji_wrapper = KojiWrapper.return_value | ||||
| @ -655,7 +676,7 @@ class TestCreateLiveImageThread(PungiTestCase): | ||||
| 
 | ||||
|         self.assertEqual(run.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', | ||||
|                                     ['/repo/amd64/Client', | ||||
|                                      'http://example.com/repo/', | ||||
| @ -703,6 +724,7 @@ class TestCreateLiveImageThread(PungiTestCase): | ||||
|             'release': 'xyz', | ||||
|             'type': 'live', | ||||
|             'failable_arches': ['*'], | ||||
|             'target': 'f27', | ||||
|         } | ||||
| 
 | ||||
|         koji_wrapper = KojiWrapper.return_value | ||||
| @ -747,6 +769,7 @@ class TestCreateLiveImageThread(PungiTestCase): | ||||
|             'release': 'xyz', | ||||
|             'type': 'live', | ||||
|             'failable_arches': ['*'], | ||||
|             'target': 'f27', | ||||
|         } | ||||
| 
 | ||||
|         koji_wrapper = KojiWrapper.return_value | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user