Add ostree container to image metadata

This requires https://github.com/release-engineering/productmd/pull/172

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2023-12-01 10:12:58 +01:00
parent 081c31238b
commit 119b212241
2 changed files with 26 additions and 7 deletions

View File

@ -6,6 +6,8 @@ import os
from kobo import shortcuts from kobo import shortcuts
from kobo.threads import ThreadPool, WorkerThread from kobo.threads import ThreadPool, WorkerThread
from productmd.images import Image
from pungi.runroot import Runroot from pungi.runroot import Runroot
from .base import ConfigGuardedPhase from .base import ConfigGuardedPhase
from .. import util from .. import util
@ -61,13 +63,8 @@ class OSTreeContainerThread(WorkerThread):
compose, variant, arch, config = item compose, variant, arch, config = item
self.num = num self.num = num
failable_arches = config.get("failable", []) failable_arches = config.get("failable", [])
with util.failable( self.can_fail = util.can_arch_fail(failable_arches, arch)
compose, with util.failable(compose, self.can_fail, variant, arch, "ostree-container"):
util.can_arch_fail(failable_arches, arch),
variant,
arch,
"ostree-container",
):
self.worker(compose, variant, arch, config) self.worker(compose, variant, arch, config)
def worker(self, 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"), 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): def _clone_repo(self, compose, repodir, url, branch):
scm.get_dir_from_scm( scm.get_dir_from_scm(
{"scm": "git", "repo": url, "branch": branch, "dir": "."}, {"scm": "git", "repo": url, "branch": branch, "dir": "."},

View File

@ -575,6 +575,7 @@ def run_compose(
and livemedia_phase.skip() and livemedia_phase.skip()
and image_build_phase.skip() and image_build_phase.skip()
and osbuild_phase.skip() and osbuild_phase.skip()
and ostree_container_phase.skip()
): ):
compose.im.dump(compose.paths.compose.metadata("images.json")) compose.im.dump(compose.paths.compose.metadata("images.json"))
compose.dump_containers_metadata() compose.dump_containers_metadata()