kiwibuild: Add support for use_buildroot_repo option

This option can be set for a particular image or globally for all
kiwibuild images (with individual overload).

Fixes: https://pagure.io/pungi/issue/1833
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
(cherry picked from commit d91adfd34d9bd97e2cc73a6023924f3f7b73cef4)
This commit is contained in:
Lubomír Sedlář 2025-04-08 15:27:46 +02:00 committed by Stepan Oksanichenko
parent 8c897dda71
commit fc2cc0073a
4 changed files with 26 additions and 0 deletions

View File

@ -1581,6 +1581,9 @@ KiwiBuild Settings
* ``manifest_type`` -- the image type that is put into the manifest by
pungi. If not supplied, an autodetected value will be provided. It may or
may not make sense.
* ``use_buildroot_repo = False`` -- (*bool*) whether the task should
automatically enable buildroot repository corresponding to the used
target.
The options can be set either for the specific image, or at the phase level
(see below). Version also falls back to ``global_version``.
@ -1606,6 +1609,9 @@ KiwiBuild Settings
**kiwibuild_repo_releasever**
(*str*) -- override releasever for all kiwibuild tasks.
**kiwibuild_use_buildroot_repo**
(*bool*) -- set enablement of a buildroot repo for all kiwibuild tasks.
OSBuild Composer for building images
====================================

View File

@ -1249,6 +1249,7 @@ def make_schema():
"version": {"type": "string"},
"repo_releasever": {"type": "string"},
"manifest_type": {"type": "string"},
"use_buildroot_repo": {"type": "boolean"},
},
"required": [
# description_scm and description_path
@ -1272,6 +1273,7 @@ def make_schema():
"kiwibuild_bundle_name_format": {"type": "string"},
"kiwibuild_version": {"type": "string"},
"kiwibuild_repo_releasever": {"type": "string"},
"kiwibuild_use_buildroot_repo": {"type": "boolean", "default": False},
"osbuild_target": {"type": "string"},
"osbuild_release": {"$ref": "#/definitions/optional_string"},
"osbuild_version": {"type": "string"},

View File

@ -98,6 +98,9 @@ class KiwiBuildPhase(
),
"version": self.get_version(image_conf),
"repo_releasever": self.get_config(image_conf, "repo_releasever"),
"use_buildroot_repo": self.get_config(
image_conf, "use_buildroot_repo"
),
}
repo = self._get_repo(image_conf, variant)
@ -160,6 +163,7 @@ class RunKiwiBuildThread(WorkerThread):
optional_arches=self.failable_arches,
version=generics["version"],
repo_releasever=generics["repo_releasever"],
use_buildroot_repo=generics["use_buildroot_repo"],
)
koji.save_task_id(task_id)

View File

@ -48,6 +48,7 @@ class TestKiwiBuildPhase(PungiTestCase):
"bundle_name_format": None,
"version": compose.image_version,
"repo_releasever": None,
"use_buildroot_repo": False,
},
[self.topdir + "/compose/Server/$arch/os"],
[], # failable arches
@ -70,6 +71,7 @@ class TestKiwiBuildPhase(PungiTestCase):
"version": "Rawhide",
"repo_releasever": "41",
"manifest_type": "live-kiwi",
"use_buildroot_repo": False,
},
MINIMAL_CONF,
)
@ -98,6 +100,7 @@ class TestKiwiBuildPhase(PungiTestCase):
"bundle_name_format": "fmt",
"version": "Rawhide",
"repo_releasever": "41",
"use_buildroot_repo": False,
},
[
"https://example.com/repo/",
@ -136,6 +139,7 @@ class TestKiwiBuildPhase(PungiTestCase):
"bundle_name_format": None,
"version": compose.image_version,
"repo_releasever": None,
"use_buildroot_repo": False,
},
[self.topdir + "/compose/Server/$arch/os"],
["x86_64"], # failable arches
@ -158,6 +162,7 @@ class TestKiwiBuildPhase(PungiTestCase):
"kiwibuild_bundle_name_format": "fmt",
"kiwibuild_version": "Rawhide",
"kiwibuild_repo_releasever": "41",
"kiwibuild_use_buildroot_repo": False,
},
)
@ -184,6 +189,7 @@ class TestKiwiBuildPhase(PungiTestCase):
"bundle_name_format": "fmt",
"version": "Rawhide",
"repo_releasever": "41",
"use_buildroot_repo": False,
},
[self.topdir + "/compose/Server/$arch/os"],
[], # failable arches
@ -226,6 +232,7 @@ class TestKiwiBuildPhase(PungiTestCase):
"bundle_name_format": None,
"version": "41",
"repo_releasever": None,
"use_buildroot_repo": False,
},
[self.topdir + "/compose/Server/$arch/os"],
[], # failable arches
@ -293,6 +300,7 @@ class TestKiwiBuildThread(PungiTestCase):
"bundle_name_format": "fmt",
"version": "v",
"repo_releasever": "r",
"use_buildroot_repo": False,
},
[self.repo],
[],
@ -315,6 +323,7 @@ class TestKiwiBuildThread(PungiTestCase):
optional_arches=[],
version="v",
repo_releasever="r",
use_buildroot_repo=False,
)
]
@ -402,6 +411,7 @@ class TestKiwiBuildThread(PungiTestCase):
"bundle_name_format": "fmt",
"version": "v",
"repo_releasever": "r",
"use_buildroot_repo": False,
},
[self.repo],
[],
@ -424,6 +434,7 @@ class TestKiwiBuildThread(PungiTestCase):
optional_arches=[],
version="v",
repo_releasever="r",
use_buildroot_repo=False,
)
]
@ -491,6 +502,7 @@ class TestKiwiBuildThread(PungiTestCase):
"bundle_name_format": None,
"version": None,
"repo_releasever": None,
"use_buildroot_repo": False,
},
[self.repo],
[],
@ -544,6 +556,7 @@ class TestKiwiBuildThread(PungiTestCase):
"bundle_name_format": None,
"version": None,
"repo_releasever": None,
"use_buildroot_repo": False,
},
[self.repo],
["amd64"],
@ -566,6 +579,7 @@ class TestKiwiBuildThread(PungiTestCase):
optional_arches=["amd64"],
version=None,
repo_releasever=None,
use_buildroot_repo=False,
)
]
assert get_image_paths.mock_calls == [mock.call(1234)]