212 lines
8.7 KiB
Diff
212 lines
8.7 KiB
Diff
From 5338d3098ccd614a8fd32f837a393aed78b471bd Mon Sep 17 00:00:00 2001
|
|
From: Adam Williamson <awilliam@redhat.com>
|
|
Date: Sep 20 2024 06:03:15 +0000
|
|
Subject: [PATCH 1/2] move osbuild/kiwi-specific EXTENSIONS to each phase
|
|
|
|
|
|
The image-build phase's EXTENSIONS dict is meant to exactly
|
|
mirror the 'formats' that exist in the context of the command
|
|
`koji image-build`, which is driven by this phase. That nice
|
|
association was lost, however, by adding a couple of items to it
|
|
which exist for the purposes of the osbuild phase (and in the
|
|
case of .iso, also the kiwibuild phase), which import this dict
|
|
and uses it for image identification.
|
|
|
|
To make the association 1:1 again and more clearly show what's
|
|
going on here, let's move those entries out into the osbuild and
|
|
kiwi phases. osbuild now has its own dict which starts out as a
|
|
copy of the image-build one before being extended. And let's
|
|
update the relevant comments.
|
|
|
|
Signed-off-by: Adam Williamson <awilliam@redhat.com>
|
|
|
|
---
|
|
|
|
diff --git a/pungi/phases/image_build.py b/pungi/phases/image_build.py
|
|
index cb76c1a..cd034cd 100644
|
|
--- a/pungi/phases/image_build.py
|
|
+++ b/pungi/phases/image_build.py
|
|
@@ -22,10 +22,13 @@ from productmd.rpms import Rpms
|
|
# This is a mapping from formats to file extensions. The format is what koji
|
|
# image-build command expects as argument, and the extension is what the file
|
|
# name will be ending with. The extensions are used to filter out which task
|
|
-# results will be pulled into the compose.
|
|
+# results will be pulled into the compose. This dict is also used later in
|
|
+# the process to set the image 'type' in productmd metadata terms - the type
|
|
+# is set as the first key in this dict which has the file's extension in its
|
|
+# values. This dict is imported and extended for similar purposes by other
|
|
+# phases (at least osbuild and kiwibuild).
|
|
EXTENSIONS = {
|
|
"docker": ["tar.gz", "tar.xz"],
|
|
- "iso": ["iso"],
|
|
"liveimg-squashfs": ["liveimg.squashfs"],
|
|
"qcow": ["qcow"],
|
|
"qcow2": ["qcow2"],
|
|
@@ -40,7 +43,6 @@ EXTENSIONS = {
|
|
"vdi": ["vdi"],
|
|
"vmdk": ["vmdk"],
|
|
"vpc": ["vhd"],
|
|
- "vhd-compressed": ["vhd.gz", "vhd.xz"],
|
|
"vsphere-ova": ["vsphere.ova"],
|
|
}
|
|
|
|
diff --git a/pungi/phases/kiwibuild.py b/pungi/phases/kiwibuild.py
|
|
index bb26812..15732ce 100644
|
|
--- a/pungi/phases/kiwibuild.py
|
|
+++ b/pungi/phases/kiwibuild.py
|
|
@@ -15,6 +15,10 @@ KIWIEXTENSIONS = [
|
|
("vhd-compressed", ["vhdfixed.xz"], "vhd.xz"),
|
|
("vagrant-libvirt", ["vagrant.libvirt.box"], "vagrant-libvirt.box"),
|
|
("vagrant-virtualbox", ["vagrant.virtualbox.box"], "vagrant-virtualbox.box"),
|
|
+ # .iso images can be of many types - boot, cd, dvd, live... -
|
|
+ # so 'boot' is just a default guess. 'iso' is not a valid
|
|
+ # productmd image type
|
|
+ ("boot", [".iso"], "iso"),
|
|
]
|
|
|
|
|
|
diff --git a/pungi/phases/osbuild.py b/pungi/phases/osbuild.py
|
|
index 6c5b7e5..a3b5c9b 100644
|
|
--- a/pungi/phases/osbuild.py
|
|
+++ b/pungi/phases/osbuild.py
|
|
@@ -11,6 +11,16 @@ from ..linker import Linker
|
|
from ..wrappers import kojiwrapper
|
|
from .image_build import EXTENSIONS
|
|
|
|
+# copy and modify EXTENSIONS with some that osbuild produces but which
|
|
+# do not exist as `koji image-build` formats
|
|
+OSBUILDEXTENSIONS = EXTENSIONS.copy()
|
|
+OSBUILDEXTENSIONS.update(
|
|
+ {
|
|
+ "iso": ["iso"],
|
|
+ "vhd-compressed": ["vhd.gz", "vhd.xz"],
|
|
+ }
|
|
+)
|
|
+
|
|
|
|
class OSBuildPhase(
|
|
base.PhaseLoggerMixin, base.ImageConfigMixin, base.ConfigGuardedPhase
|
|
@@ -203,7 +213,7 @@ class RunOSBuildThread(WorkerThread):
|
|
# architecture, but we don't verify that.
|
|
build_info = koji.koji_proxy.getBuild(build_id)
|
|
for archive in koji.koji_proxy.listArchives(buildID=build_id):
|
|
- if archive["type_name"] not in EXTENSIONS:
|
|
+ if archive["type_name"] not in OSBUILDEXTENSIONS:
|
|
# Ignore values that are not of required types.
|
|
continue
|
|
|
|
@@ -241,7 +251,7 @@ class RunOSBuildThread(WorkerThread):
|
|
|
|
linker.link(src_file, image_dest, link_type=compose.conf["link_type"])
|
|
|
|
- for suffix in EXTENSIONS[archive["type_name"]]:
|
|
+ for suffix in OSBUILDEXTENSIONS[archive["type_name"]]:
|
|
if archive["filename"].endswith(suffix):
|
|
break
|
|
else:
|
|
|
|
From 739062ed3c471e74ba9c5144c4047f67f9fbe8c8 Mon Sep 17 00:00:00 2001
|
|
From: Adam Williamson <awilliam@redhat.com>
|
|
Date: Sep 20 2024 06:03:58 +0000
|
|
Subject: [PATCH 2/2] image_build: drop .tar.gz as an expected extension for docker
|
|
|
|
|
|
Koji's image-build command has not been capable of producing a
|
|
docker image with .tar.gz as its extension since 2015:
|
|
|
|
https://pagure.io/koji/c/b489f282bee7a008108534404dd2e78efb2256e7?branch=master
|
|
|
|
as that commit message implies, the files have not actually been
|
|
gzip-compressed for even longer:
|
|
|
|
https://pagure.io/koji/c/82a405c7943192e3bba3340efe7a8d07a0e26b70?branch=master
|
|
|
|
so there's no point to having this any more. It is causing the
|
|
wrong productmd 'type' to be set for GCE cloud images, which *do*
|
|
have the .tar.gz extension - because docker appears in this dict
|
|
before tar-gz, their type is being set as 'docker' not 'tar-gz'.
|
|
|
|
Signed-off-by: Adam Williamson <awilliam@redhat.com>
|
|
|
|
---
|
|
|
|
diff --git a/pungi/phases/image_build.py b/pungi/phases/image_build.py
|
|
index cd034cd..c28ccc2 100644
|
|
--- a/pungi/phases/image_build.py
|
|
+++ b/pungi/phases/image_build.py
|
|
@@ -28,7 +28,7 @@ from productmd.rpms import Rpms
|
|
# values. This dict is imported and extended for similar purposes by other
|
|
# phases (at least osbuild and kiwibuild).
|
|
EXTENSIONS = {
|
|
- "docker": ["tar.gz", "tar.xz"],
|
|
+ "docker": ["tar.xz"],
|
|
"liveimg-squashfs": ["liveimg.squashfs"],
|
|
"qcow": ["qcow"],
|
|
"qcow2": ["qcow2"],
|
|
diff --git a/tests/test_imagebuildphase.py b/tests/test_imagebuildphase.py
|
|
index 90f10ef..895f040 100644
|
|
--- a/tests/test_imagebuildphase.py
|
|
+++ b/tests/test_imagebuildphase.py
|
|
@@ -846,12 +846,12 @@ class TestCreateImageBuildThread(PungiTestCase):
|
|
"amd64": [
|
|
"/koji/task/1235/tdl-amd64.xml",
|
|
"/koji/task/1235/Fedora-Docker-Base-20160103.amd64.qcow2",
|
|
- "/koji/task/1235/Fedora-Docker-Base-20160103.amd64.tar.gz",
|
|
+ "/koji/task/1235/Fedora-Docker-Base-20160103.amd64.tar.xz",
|
|
],
|
|
"x86_64": [
|
|
"/koji/task/1235/tdl-x86_64.xml",
|
|
"/koji/task/1235/Fedora-Docker-Base-20160103.x86_64.qcow2",
|
|
- "/koji/task/1235/Fedora-Docker-Base-20160103.x86_64.tar.gz",
|
|
+ "/koji/task/1235/Fedora-Docker-Base-20160103.x86_64.tar.xz",
|
|
],
|
|
}
|
|
|
|
@@ -896,9 +896,9 @@ class TestCreateImageBuildThread(PungiTestCase):
|
|
link_type="hardlink-or-copy",
|
|
),
|
|
mock.call.link(
|
|
- "/koji/task/1235/Fedora-Docker-Base-20160103.amd64.tar.gz",
|
|
+ "/koji/task/1235/Fedora-Docker-Base-20160103.amd64.tar.xz",
|
|
self.topdir
|
|
- + "/compose/Client/amd64/images/Fedora-Docker-Base-20160103.amd64.tar.gz", # noqa: E501
|
|
+ + "/compose/Client/amd64/images/Fedora-Docker-Base-20160103.amd64.tar.xz", # noqa: E501
|
|
link_type="hardlink-or-copy",
|
|
),
|
|
mock.call.link(
|
|
@@ -908,9 +908,9 @@ class TestCreateImageBuildThread(PungiTestCase):
|
|
link_type="hardlink-or-copy",
|
|
),
|
|
mock.call.link(
|
|
- "/koji/task/1235/Fedora-Docker-Base-20160103.x86_64.tar.gz",
|
|
+ "/koji/task/1235/Fedora-Docker-Base-20160103.x86_64.tar.xz",
|
|
self.topdir
|
|
- + "/compose/Client/x86_64/images/Fedora-Docker-Base-20160103.x86_64.tar.gz", # noqa: E501
|
|
+ + "/compose/Client/x86_64/images/Fedora-Docker-Base-20160103.x86_64.tar.xz", # noqa: E501
|
|
link_type="hardlink-or-copy",
|
|
),
|
|
],
|
|
@@ -922,8 +922,8 @@ class TestCreateImageBuildThread(PungiTestCase):
|
|
"type": "qcow2",
|
|
"arch": "amd64",
|
|
},
|
|
- "image_dir/Client/amd64/Fedora-Docker-Base-20160103.amd64.tar.gz": {
|
|
- "format": "tar.gz",
|
|
+ "image_dir/Client/amd64/Fedora-Docker-Base-20160103.amd64.tar.xz": {
|
|
+ "format": "tar.xz",
|
|
"type": "docker",
|
|
"arch": "amd64",
|
|
},
|
|
@@ -932,8 +932,8 @@ class TestCreateImageBuildThread(PungiTestCase):
|
|
"type": "qcow2",
|
|
"arch": "x86_64",
|
|
},
|
|
- "image_dir/Client/x86_64/Fedora-Docker-Base-20160103.x86_64.tar.gz": {
|
|
- "format": "tar.gz",
|
|
+ "image_dir/Client/x86_64/Fedora-Docker-Base-20160103.x86_64.tar.xz": {
|
|
+ "format": "tar.xz",
|
|
"type": "docker",
|
|
"arch": "x86_64",
|
|
},
|
|
|