From 38ec4ca1596b15d496b97505cb23551ff8264271 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Fri, 1 Dec 2023 10:12:58 +0100 Subject: [PATCH] Add ostree container to image metadata MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This requires https://github.com/release-engineering/productmd/pull/172 Signed-off-by: Lubomír Sedlář (cherry picked from commit 119b2122415ae7fd1cdc37f2eb18723f3add57ee) --- pungi/phases/ostree_container.py | 32 +++++++++++++++++++++++++------- pungi/scripts/pungi_koji.py | 1 + 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/pungi/phases/ostree_container.py b/pungi/phases/ostree_container.py index b5030581..bd2fd4e0 100644 --- a/pungi/phases/ostree_container.py +++ b/pungi/phases/ostree_container.py @@ -6,6 +6,8 @@ import os from kobo import shortcuts from kobo.threads import ThreadPool, WorkerThread +from productmd.images import Image + from pungi.runroot import Runroot from .base import ConfigGuardedPhase from .. import util @@ -61,13 +63,8 @@ class OSTreeContainerThread(WorkerThread): compose, variant, arch, config = item self.num = num failable_arches = config.get("failable", []) - with util.failable( - compose, - util.can_arch_fail(failable_arches, arch), - variant, - arch, - "ostree-container", - ): + self.can_fail = util.can_arch_fail(failable_arches, arch) + with util.failable(compose, self.can_fail, variant, arch, "ostree-container"): self.worker(compose, variant, arch, config) def worker(self, compose, variant, arch, config): @@ -162,6 +159,27 @@ class OSTreeContainerThread(WorkerThread): weight=compose.conf["runroot_weights"].get("ostree"), ) + fullpath = os.path.join(target_dir, "%s.ociarchive" % archive_name) + + # Update image manifest + img = Image(compose.im) + + # Get the manifest type from the config if supplied, otherwise we + # determine the manifest type based on the koji output + img.type = "ociarchive" + img.format = "ociarchive" + img.path = os.path.relpath(fullpath, compose.paths.compose.topdir()) + img.mtime = util.get_mtime(fullpath) + img.size = util.get_file_size(fullpath) + img.arch = arch + img.disc_number = 1 + img.disc_count = 1 + img.bootable = False + img.subvariant = config.get("subvariant", variant.uid) + setattr(img, "can_fail", self.can_fail) + setattr(img, "deliverable", "ostree-container") + compose.im.add(variant=variant.uid, arch=arch, image=img) + def _clone_repo(self, compose, repodir, url, branch): scm.get_dir_from_scm( {"scm": "git", "repo": url, "branch": branch, "dir": "."}, diff --git a/pungi/scripts/pungi_koji.py b/pungi/scripts/pungi_koji.py index b5819ab1..87c2ab64 100644 --- a/pungi/scripts/pungi_koji.py +++ b/pungi/scripts/pungi_koji.py @@ -581,6 +581,7 @@ def run_compose( and livemedia_phase.skip() and image_build_phase.skip() and osbuild_phase.skip() + and ostree_container_phase.skip() ): compose.im.dump(compose.paths.compose.metadata("images.json")) compose.dump_containers_metadata()