PR #1789 improved various aspects of the ostree_container phase regarding subvariant handling and filenames, this is mainly to help us with how we want to handle bootc images (currently in the IoT compose, but the generic base bootc image may move to the Fedora compose). PR #1790 rejigs the compose phase handling so the main image build phase is not unnecessarily blocked on the ostree_install phase. This should cut 60-90 minutes out of the main Fedora compose time. (cherry picked from commit 13884fef2c199b613442af03c24b737a7e3cb057)
147 lines
6.3 KiB
Diff
147 lines
6.3 KiB
Diff
From 391a5eaed5198e5ee2941dac4ae43a2fe057eedd Mon Sep 17 00:00:00 2001
|
|
From: Adam Williamson <awilliam@redhat.com>
|
|
Date: Oct 09 2024 23:28:54 +0000
|
|
Subject: [PATCH 1/2] Correct subvariant handling for ostree_container phase
|
|
|
|
|
|
The image metadata construction code allows for subvariant to be
|
|
set in the image config dict, but checks.py doesn't expect it;
|
|
fix that. Also, when a subvariant is set, use it in the image
|
|
name template rather than the variant; otherwise you can't
|
|
build more than one subvariant in any variant (they will have
|
|
identical names, which isn't alllowed).
|
|
|
|
Signed-off-by: Adam Williamson <awilliam@redhat.com>
|
|
|
|
---
|
|
|
|
diff --git a/doc/configuration.rst b/doc/configuration.rst
|
|
index ded479e..90621bb 100644
|
|
--- a/doc/configuration.rst
|
|
+++ b/doc/configuration.rst
|
|
@@ -1886,6 +1886,10 @@ will thus create a new OCI archive image *from scratch*.
|
|
reference will not be created.
|
|
* ``runroot_packages`` -- (*list*) A list of additional package names to be
|
|
installed in the runroot environment in Koji.
|
|
+ * ``subvariant`` -- (*str*) The subvariant value to be used in the metadata
|
|
+ for the image. Also used in the image's filename. Defaults to being the
|
|
+ same as the variant. If building more than one ostree container in a
|
|
+ variant, each must have a unique subvariant.
|
|
|
|
Example config
|
|
--------------
|
|
diff --git a/pungi/checks.py b/pungi/checks.py
|
|
index cc16d12..e23babc 100644
|
|
--- a/pungi/checks.py
|
|
+++ b/pungi/checks.py
|
|
@@ -1101,6 +1101,7 @@ def make_schema():
|
|
"runroot_packages": {
|
|
"$ref": "#/definitions/list_of_strings",
|
|
},
|
|
+ "subvariant": {"type": "string"},
|
|
},
|
|
"required": [
|
|
"treefile",
|
|
diff --git a/pungi/phases/ostree_container.py b/pungi/phases/ostree_container.py
|
|
index 38a647e..e111998 100644
|
|
--- a/pungi/phases/ostree_container.py
|
|
+++ b/pungi/phases/ostree_container.py
|
|
@@ -119,12 +119,13 @@ class OSTreeContainerThread(WorkerThread):
|
|
def _run_ostree_container_cmd(
|
|
self, compose, variant, arch, config, config_repo, extra_config_file=None
|
|
):
|
|
+ subvariant = config.get("subvariant", variant.uid)
|
|
target_dir = compose.paths.compose.image_dir(variant) % {"arch": arch}
|
|
util.makedirs(target_dir)
|
|
version = util.version_generator(compose, config.get("version"))
|
|
archive_name = "%s-%s-%s" % (
|
|
compose.conf["release_short"],
|
|
- variant.uid,
|
|
+ subvariant,
|
|
version,
|
|
)
|
|
|
|
@@ -177,7 +178,7 @@ class OSTreeContainerThread(WorkerThread):
|
|
img.disc_number = 1
|
|
img.disc_count = 1
|
|
img.bootable = False
|
|
- img.subvariant = config.get("subvariant", variant.uid)
|
|
+ img.subvariant = subvariant
|
|
setattr(img, "can_fail", self.can_fail)
|
|
setattr(img, "deliverable", "ostree-container")
|
|
compose.im.add(variant=variant.uid, arch=arch, image=img)
|
|
|
|
From aea8da5225aeb31b4c5dd413f0a31b6ab395a9ac Mon Sep 17 00:00:00 2001
|
|
From: Adam Williamson <awilliam@redhat.com>
|
|
Date: Oct 09 2024 23:33:48 +0000
|
|
Subject: [PATCH 2/2] ostree_container: make filename configurable, include arch
|
|
|
|
|
|
The default base name is probably fine in most cases, but there
|
|
are some where we might want to tweak it. We already allow this
|
|
for other phases (e.g. the livemedia phase).
|
|
|
|
Also, we should include the arch in the image filename. Not doing
|
|
this doesn't blow up the compose as, while they have identical
|
|
filenames, the images for different arches are in different paths,
|
|
but it's confusing for people who actually download and use the
|
|
images.
|
|
|
|
Signed-off-by: Adam Williamson <awilliam@redhat.com>
|
|
|
|
---
|
|
|
|
diff --git a/doc/configuration.rst b/doc/configuration.rst
|
|
index 90621bb..14947fe 100644
|
|
--- a/doc/configuration.rst
|
|
+++ b/doc/configuration.rst
|
|
@@ -1887,9 +1887,14 @@ will thus create a new OCI archive image *from scratch*.
|
|
* ``runroot_packages`` -- (*list*) A list of additional package names to be
|
|
installed in the runroot environment in Koji.
|
|
* ``subvariant`` -- (*str*) The subvariant value to be used in the metadata
|
|
- for the image. Also used in the image's filename. Defaults to being the
|
|
- same as the variant. If building more than one ostree container in a
|
|
- variant, each must have a unique subvariant.
|
|
+ for the image. Also used in the image's filename, unless overridden by
|
|
+ ``name``. Defaults to being the same as the variant. If building more
|
|
+ than one ostree container in a variant, each must have a unique
|
|
+ subvariant.
|
|
+ * ``name`` -- (*str*) The base for the image's filename. To produce the
|
|
+ complete filename, the image's architecture, the version string, and the
|
|
+ format suffix are appended to this. Defaults to the value of
|
|
+ ``release_short`` and the subvariant, joined by a dash.
|
|
|
|
Example config
|
|
--------------
|
|
diff --git a/pungi/checks.py b/pungi/checks.py
|
|
index e23babc..0cdb619 100644
|
|
--- a/pungi/checks.py
|
|
+++ b/pungi/checks.py
|
|
@@ -1102,6 +1102,7 @@ def make_schema():
|
|
"$ref": "#/definitions/list_of_strings",
|
|
},
|
|
"subvariant": {"type": "string"},
|
|
+ "name": {"type": "string"},
|
|
},
|
|
"required": [
|
|
"treefile",
|
|
diff --git a/pungi/phases/ostree_container.py b/pungi/phases/ostree_container.py
|
|
index e111998..c50633d 100644
|
|
--- a/pungi/phases/ostree_container.py
|
|
+++ b/pungi/phases/ostree_container.py
|
|
@@ -123,11 +123,8 @@ class OSTreeContainerThread(WorkerThread):
|
|
target_dir = compose.paths.compose.image_dir(variant) % {"arch": arch}
|
|
util.makedirs(target_dir)
|
|
version = util.version_generator(compose, config.get("version"))
|
|
- archive_name = "%s-%s-%s" % (
|
|
- compose.conf["release_short"],
|
|
- subvariant,
|
|
- version,
|
|
- )
|
|
+ anb = config.get("name", "%s-%s" % (compose.conf["release_short"], subvariant))
|
|
+ archive_name = "%s-%s-%s" % (anb, arch, version)
|
|
|
|
# Run the pungi-make-ostree command locally to create a script to
|
|
# execute in runroot environment.
|
|
|