kiwibuild: Add support for type, type attr and bundle format

This is a very basic support. Whatever users specify in the new option
will be passed to the koji task.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=2270197
Related: https://pagure.io/koji/pull-request/4157
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2024-03-20 14:30:09 +01:00 committed by lsedlar
parent d546a49299
commit e43cf68f08
4 changed files with 70 additions and 1 deletions

View File

@ -1566,6 +1566,10 @@ KiwiBuild Settings
provided, all variant architectures will be built. provided, all variant architectures will be built.
* ``failable`` -- (*[str]*) List of architectures for which this * ``failable`` -- (*[str]*) List of architectures for which this
deliverable is not release blocking. deliverable is not release blocking.
* ``type`` -- (*str*) override default type from the bundle with this value.
* ``type_attr`` -- (*[str]*) override default attributes for the build type
from description.
* ``bundle_name_format`` -- (*str*) override default bundle format name.
**kiwibuild_description_scm** **kiwibuild_description_scm**
(*str*) -- URL for scm containing the description files (*str*) -- URL for scm containing the description files
@ -1573,6 +1577,15 @@ KiwiBuild Settings
**kiwibuild_description_path** **kiwibuild_description_path**
(*str*) -- path to a description file within the description scm (*str*) -- path to a description file within the description scm
**kiwibuild_type**
(*str*) -- override default type from the bundle with this value.
**kiwibuild_type_attr**
(*[str]*) -- override default attributes for the build type from description.
**kiwibuild_bundle_name_format**
(*str*) -- override default bundle format name.
OSBuild Composer for building images OSBuild Composer for building images
==================================== ====================================

View File

@ -1209,6 +1209,9 @@ def make_schema():
"repos": {"$ref": "#/definitions/list_of_strings"}, "repos": {"$ref": "#/definitions/list_of_strings"},
"failable": {"$ref": "#/definitions/list_of_strings"}, "failable": {"$ref": "#/definitions/list_of_strings"},
"subvariant": {"type": "string"}, "subvariant": {"type": "string"},
"type": {"type": "string"},
"type_attr": {"$ref": "#/definitions/list_of_strings"},
"bundle_name_format": {"type": "string"},
}, },
"required": [ "required": [
# description_scm and description_path # description_scm and description_path
@ -1227,6 +1230,9 @@ def make_schema():
"kiwibuild_description_path": {"type": "string"}, "kiwibuild_description_path": {"type": "string"},
"kiwibuild_target": {"type": "string"}, "kiwibuild_target": {"type": "string"},
"kiwibuild_release": {"$ref": "#/definitions/optional_string"}, "kiwibuild_release": {"$ref": "#/definitions/optional_string"},
"kiwibuild_type": {"type": "string"},
"kiwibuild_type_attr": {"$ref": "#/definitions/list_of_strings"},
"kiwibuild_bundle_name_format": {"type": "string"},
"osbuild_target": {"type": "string"}, "osbuild_target": {"type": "string"},
"osbuild_release": {"$ref": "#/definitions/optional_string"}, "osbuild_release": {"$ref": "#/definitions/optional_string"},
"osbuild_version": {"type": "string"}, "osbuild_version": {"type": "string"},

View File

@ -79,6 +79,11 @@ class KiwiBuildPhase(
"target": self.get_config(image_conf, "target"), "target": self.get_config(image_conf, "target"),
"descscm": self.get_config(image_conf, "description_scm"), "descscm": self.get_config(image_conf, "description_scm"),
"descpath": self.get_config(image_conf, "description_path"), "descpath": self.get_config(image_conf, "description_path"),
"type": self.get_config(image_conf, "type"),
"type_attr": self.get_config(image_conf, "type_attr"),
"bundle_name_format": self.get_config(
image_conf, "bundle_name_format"
),
} }
repo = self._get_repo(image_conf, variant) repo = self._get_repo(image_conf, variant)
@ -134,6 +139,9 @@ class RunKiwiBuildThread(WorkerThread):
profile=config["kiwi_profile"], profile=config["kiwi_profile"],
release=generics["release"], release=generics["release"],
repos=repo, repos=repo,
type=generics["type"],
type_attr=generics["type_attr"],
result_bundle_name_format=generics["bundle_name_format"],
# this ensures the task won't fail if only failable arches fail # this ensures the task won't fail if only failable arches fail
optional_arches=self.failable_arches, optional_arches=self.failable_arches,
) )

View File

@ -47,6 +47,9 @@ class TestKiwiBuildPhase(PungiTestCase):
"target": "f40", "target": "f40",
"descscm": MINIMAL_CONF["description_scm"], "descscm": MINIMAL_CONF["description_scm"],
"descpath": MINIMAL_CONF["description_path"], "descpath": MINIMAL_CONF["description_path"],
"type": None,
"type_attr": None,
"bundle_name_format": None,
}, },
[self.topdir + "/compose/Server/$arch/os"], [self.topdir + "/compose/Server/$arch/os"],
[], # failable arches [], # failable arches
@ -63,6 +66,9 @@ class TestKiwiBuildPhase(PungiTestCase):
"repos": ["https://example.com/repo/", "Client"], "repos": ["https://example.com/repo/", "Client"],
"failable": ["*"], "failable": ["*"],
"subvariant": "Test", "subvariant": "Test",
"type": "custom",
"type_attr": ["foo", "bar"],
"bundle_name_format": "fmt",
}, },
MINIMAL_CONF, MINIMAL_CONF,
) )
@ -86,6 +92,9 @@ class TestKiwiBuildPhase(PungiTestCase):
"target": "f40", "target": "f40",
"descscm": MINIMAL_CONF["description_scm"], "descscm": MINIMAL_CONF["description_scm"],
"descpath": MINIMAL_CONF["description_path"], "descpath": MINIMAL_CONF["description_path"],
"type": "custom",
"type_attr": ["foo", "bar"],
"bundle_name_format": "fmt",
}, },
[ [
"https://example.com/repo/", "https://example.com/repo/",
@ -119,6 +128,9 @@ class TestKiwiBuildPhase(PungiTestCase):
"target": "f40", "target": "f40",
"descscm": MINIMAL_CONF["description_scm"], "descscm": MINIMAL_CONF["description_scm"],
"descpath": MINIMAL_CONF["description_path"], "descpath": MINIMAL_CONF["description_path"],
"type": None,
"type_attr": None,
"bundle_name_format": None,
}, },
[self.topdir + "/compose/Server/$arch/os"], [self.topdir + "/compose/Server/$arch/os"],
["x86_64"], # failable arches ["x86_64"], # failable arches
@ -136,6 +148,9 @@ class TestKiwiBuildPhase(PungiTestCase):
"kiwibuild_release": "1234", "kiwibuild_release": "1234",
"kiwibuild_description_scm": "foo", "kiwibuild_description_scm": "foo",
"kiwibuild_description_path": "bar", "kiwibuild_description_path": "bar",
"kiwibuild_type": "custom",
"kiwibuild_type_attr": ["foo", "bar"],
"kiwibuild_bundle_name_format": "fmt",
}, },
) )
@ -157,6 +172,9 @@ class TestKiwiBuildPhase(PungiTestCase):
"target": "f40", "target": "f40",
"descscm": "foo", "descscm": "foo",
"descpath": "bar", "descpath": "bar",
"type": "custom",
"type_attr": ["foo", "bar"],
"bundle_name_format": "fmt",
}, },
[self.topdir + "/compose/Server/$arch/os"], [self.topdir + "/compose/Server/$arch/os"],
[], # failable arches [], # failable arches
@ -193,6 +211,9 @@ class TestKiwiBuildPhase(PungiTestCase):
"target": "f40", "target": "f40",
"descscm": MINIMAL_CONF["description_scm"], "descscm": MINIMAL_CONF["description_scm"],
"descpath": MINIMAL_CONF["description_path"], "descpath": MINIMAL_CONF["description_path"],
"type": None,
"type_attr": None,
"bundle_name_format": None,
}, },
[self.topdir + "/compose/Server/$arch/os"], [self.topdir + "/compose/Server/$arch/os"],
[], # failable arches [], # failable arches
@ -215,7 +236,13 @@ class TestKiwiBuildThread(PungiTestCase):
def test_process(self, KojiWrapper, get_file_size, get_mtime, Linker): def test_process(self, KojiWrapper, get_file_size, get_mtime, Linker):
img_name = "FCBG.{arch}-Rawhide-1.6.vagrant.libvirt.box" img_name = "FCBG.{arch}-Rawhide-1.6.vagrant.libvirt.box"
self.repo = self.topdir + "/compose/Server/$arch/os" self.repo = self.topdir + "/compose/Server/$arch/os"
compose = DummyCompose(self.topdir, {"koji_profile": "koji"}) compose = DummyCompose(
self.topdir,
{
"koji_profile": "koji",
"kiwibuild_bundle_format": "%N-%P-40_Beta-%I.%A.%T",
},
)
config = _merge({"subvariant": "Test"}, MINIMAL_CONF) config = _merge({"subvariant": "Test"}, MINIMAL_CONF)
pool = mock.Mock() pool = mock.Mock()
@ -248,6 +275,9 @@ class TestKiwiBuildThread(PungiTestCase):
"target": "f40", "target": "f40",
"descscm": MINIMAL_CONF["description_scm"], "descscm": MINIMAL_CONF["description_scm"],
"descpath": MINIMAL_CONF["description_path"], "descpath": MINIMAL_CONF["description_path"],
"type": "t",
"type_attr": ["ta"],
"bundle_name_format": "fmt",
}, },
[self.repo], [self.repo],
[], [],
@ -264,6 +294,9 @@ class TestKiwiBuildThread(PungiTestCase):
profile=MINIMAL_CONF["kiwi_profile"], profile=MINIMAL_CONF["kiwi_profile"],
release="1.6", release="1.6",
repos=[self.repo], repos=[self.repo],
type="t",
type_attr=["ta"],
result_bundle_name_format="fmt",
optional_arches=[], optional_arches=[],
) )
] ]
@ -326,6 +359,9 @@ class TestKiwiBuildThread(PungiTestCase):
"target": "f40", "target": "f40",
"descscm": MINIMAL_CONF["description_scm"], "descscm": MINIMAL_CONF["description_scm"],
"descpath": MINIMAL_CONF["description_path"], "descpath": MINIMAL_CONF["description_path"],
"type": None,
"type_attr": None,
"bundle_name_format": None,
}, },
[self.repo], [self.repo],
[], [],
@ -374,6 +410,9 @@ class TestKiwiBuildThread(PungiTestCase):
"target": "f40", "target": "f40",
"descscm": MINIMAL_CONF["description_scm"], "descscm": MINIMAL_CONF["description_scm"],
"descpath": MINIMAL_CONF["description_path"], "descpath": MINIMAL_CONF["description_path"],
"type": None,
"type_attr": None,
"bundle_name_format": None,
}, },
[self.repo], [self.repo],
["amd64"], ["amd64"],
@ -390,6 +429,9 @@ class TestKiwiBuildThread(PungiTestCase):
profile=MINIMAL_CONF["kiwi_profile"], profile=MINIMAL_CONF["kiwi_profile"],
release="1.6", release="1.6",
repos=[self.repo], repos=[self.repo],
type=None,
type_attr=None,
result_bundle_name_format=None,
optional_arches=["amd64"], optional_arches=["amd64"],
) )
] ]