osbuild: Handle wsl2 images

The images are imported to Koji with type_name set to wsl. We need to
know about this so that the image is pulled into the compose, and also
translate the type into correct value for productmd.

JIRA: RHELCMP-14724
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
(cherry picked from commit 3ff06bc8ea0345a3c96afe6c1f44a83615ed02d0)
This commit is contained in:
Lubomír Sedlář 2025-08-08 10:57:24 +02:00 committed by Stepan Oksanichenko
parent 2fbc4e7bcb
commit 834ee63331

View File

@ -16,9 +16,14 @@ from ..threading import TelemetryWorkerThread as WorkerThread
# do not exist as `koji image-build` formats
OSBUILDEXTENSIONS = EXTENSIONS.copy()
OSBUILDEXTENSIONS.update(
# The key is the type_name as used in Koji archive, the second is a list of
# expected file extensions.
{
"iso": ["iso"],
"vhd-compressed": ["vhd.gz", "vhd.xz"],
# The image is technically wsl2, but the type_name in Koji is set to
# wsl.
"wsl": ["wsl"],
}
)
@ -269,7 +274,13 @@ class RunOSBuildThread(WorkerThread):
# determine the manifest type based on the koji output
img.type = config.get("manifest_type")
if not img.type:
if archive["type_name"] != "iso":
if archive["type_name"] == "wsl":
# productmd only knows wsl2 as type, so let's translate
# from the koji type so that users don't need to set the
# type explicitly. There really is no other possible type
# here anyway.
img.type = "wsl2"
elif archive["type_name"] != "iso":
img.type = archive["type_name"]
else:
fn = archive["filename"].lower()