From b805ce3d129420beb39957a08ef307a8e27c0084 Mon Sep 17 00:00:00 2001 From: Ken Dreyer Date: Thu, 17 Mar 2022 11:04:02 -0400 Subject: [PATCH] osbs: only handle archives of type "image" Prior to this change, if a container image used Cachito with OSBS, then OSBS would store additional "remote-sources" files in the Koji archives for the build. Pungi cannot parse the metadata for these archive entries, so it would crash in add_metadata(): File "pungi/phases/osbs.py", line 81, in process self.worker(compose, variant, config) File "pungi/phases/osbs.py", line 141, in worker nvr, archive_ids = add_metadata(variant, task_id, compose, scratch) File "pungi/phases/osbs.py", line 447, in add_metadata arch = archive["extra"]["image"]["arch"] KeyError: 'image' Tell Koji to only return container image archives, and ignore these remote-source archives. Signed-off-by: Ken Dreyer --- pungi/phases/osbs.py | 2 +- tests/test_osbs_phase.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pungi/phases/osbs.py b/pungi/phases/osbs.py index 9db4371e..e5ddcb60 100644 --- a/pungi/phases/osbs.py +++ b/pungi/phases/osbs.py @@ -422,7 +422,7 @@ def add_metadata(variant, task_id, compose, is_scratch): else: build_id = int(result["koji_builds"][0]) buildinfo = koji.koji_proxy.getBuild(build_id) - archives = koji.koji_proxy.listArchives(build_id) + archives = koji.koji_proxy.listArchives(build_id, type="image") nvr = "%(name)s-%(version)s-%(release)s" % buildinfo diff --git a/tests/test_osbs_phase.py b/tests/test_osbs_phase.py index 5ad64d83..9a45dfea 100644 --- a/tests/test_osbs_phase.py +++ b/tests/test_osbs_phase.py @@ -235,7 +235,7 @@ class OSBSThreadTest(helpers.PungiTestCase): expect_calls.extend( [ mock.call.koji_proxy.getBuild(54321), - mock.call.koji_proxy.listArchives(54321), + mock.call.koji_proxy.listArchives(54321, type="image"), mock.call.koji_proxy.listRPMs(imageID=1436049), ] )