From 8f0906be53835e783b1a007396bccecd82ce34cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hozza?= Date: Wed, 23 Nov 2022 17:07:26 +0100 Subject: [PATCH] osbuild: support specifying `package_sets` for repos MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `koji-osbuild` plugin supports additional formats for the `repo` property since v4 [1]. Specifically, a repo can be specified as a dictionary with `baseurl` key and `package_sets` list containing specific package set names, that the repository should be used for. Extend the configuration schema to reflect the plugin change. Extend the documentation to cover the new repository format. Extend an existing unit test to specify additional repository using the added format. [1] https://github.com/osbuild/koji-osbuild/pull/82 Signed-off-by: Tomáš Hozza --- doc/configuration.rst | 17 ++++++++++++++++- pungi/checks.py | 21 ++++++++++++++++++++- tests/test_osbuild_phase.py | 16 ++++++++++++++-- 3 files changed, 50 insertions(+), 4 deletions(-) diff --git a/doc/configuration.rst b/doc/configuration.rst index 0ae95638..c0119d6d 100644 --- a/doc/configuration.rst +++ b/doc/configuration.rst @@ -1607,8 +1607,23 @@ OSBuild Composer for building images * ``release`` -- release part of the final NVR. If neither this option nor the global ``osbuild_release`` is set, Koji will automatically generate a value. - * ``repo`` -- a list of repository URLs from which to consume packages for + * ``repo`` -- a list of repositories from which to consume packages for building the image. By default only the variant repository is used. + The list items may use one of the following formats: + + * String with just the repository URL. + + * Dictionary with the following keys: + + * ``baseurl`` -- URL of the repository. + * ``package_sets`` -- a list of package set names to use for this + repository. Package sets are an internal concept of Image Builder + and are used in image definitions. If specified, the repository is + used by Image Builder only for the pipeline with the same name. + For example, specifying the ``build`` package set name will make + the repository to be used only for the build environment in which + the image will be built. (optional) + * ``arches`` -- list of architectures for which to build the image. By default, the variant arches are used. This option can only restrict it, not add a new one. diff --git a/pungi/checks.py b/pungi/checks.py index 5d110c21..1b0bf201 100644 --- a/pungi/checks.py +++ b/pungi/checks.py @@ -1188,7 +1188,26 @@ def make_schema(): }, "arches": {"$ref": "#/definitions/list_of_strings"}, "release": {"type": "string"}, - "repo": {"$ref": "#/definitions/list_of_strings"}, + "repo": { + "type": "array", + "items": { + "oneOf": [ + { + "type": "object", + "additionalProperties": False, + "required": ["baseurl"], + "properties": { + "baseurl": {"type": "string"}, + "package_sets": { + "type": "array", + "items": {"type": "string"}, + }, + }, + }, + {"type": "string"}, + ] + }, + }, "failable": {"$ref": "#/definitions/list_of_strings"}, "subvariant": {"type": "string"}, "ostree_url": {"type": "string"}, diff --git a/tests/test_osbuild_phase.py b/tests/test_osbuild_phase.py index e545a39e..a4c57817 100644 --- a/tests/test_osbuild_phase.py +++ b/tests/test_osbuild_phase.py @@ -251,7 +251,13 @@ class RunOSBuildThreadTest(helpers.PungiTestCase): "1", # version "15", # release "image-target", - [self.topdir + "/compose/Everything/$arch/os"], + [ + self.topdir + "/compose/Everything/$arch/os", + { + "baseurl": self.topdir + "/compose/Everything/$arch/os", + "package_sets": ["build"], + }, + ], ["x86_64"], ), 1, @@ -273,7 +279,13 @@ class RunOSBuildThreadTest(helpers.PungiTestCase): ["aarch64", "x86_64"], opts={ "release": "15", - "repo": [self.topdir + "/compose/Everything/$arch/os"], + "repo": [ + self.topdir + "/compose/Everything/$arch/os", + { + "baseurl": self.topdir + "/compose/Everything/$arch/os", + "package_sets": ["build"], + }, + ], }, ), mock.call.save_task_id(1234),