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 <kdreyer@redhat.com>
This commit is contained in:
Ken Dreyer 2022-03-17 11:04:02 -04:00
parent 0e82663327
commit b805ce3d12
2 changed files with 2 additions and 2 deletions

View File

@ -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

View File

@ -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),
]
)