#1595 listArchives in osbs.py can crash on remote-sources tarballs
Closed: Fixed 2 years ago by hlin. Opened 2 years ago by ktdreyer.

We hit the following traceback with Pungi 4.3.3 today in add_metadata():

  File "/usr/lib/python2.7/site-packages/pungi/phases/osbs.py", line 81, in process
    self.worker(compose, variant, config)
  File "/usr/lib/python2.7/site-packages/pungi/phases/osbs.py", line 141, in worker
    nvr, archive_ids = add_metadata(variant, task_id, compose, scratch)
  File "/usr/lib/python2.7/site-packages/pungi/phases/osbs.py", line 447, in add_metadata
    arch = archive["extra"]["image"]["arch"]
KeyError: 'image'
Frame add_metadata in /usr/lib/python2.7/site-packages/pungi/phases/osbs.py at line 447

The problem is that OSBS now attaches "remote-sources.tar.gz" files to Koji builds. These files have no "image" key in "extras". They look like this:

  {
    "btype": "remote-sources",
    "btype_id": 7,
    "build_id": 1930805,
    "buildroot_id": 8460502,
    "checksum": "9a48ed22bcb6575175ffb27c9f1dcb8a",
    "checksum_type": 0,
    "extra": {
      "typeinfo": {
        "remote-sources": {}
      }
    },
    "filename": "remote-source.tar.gz",
    "id": 6121495,
    "metadata_only": false,
    "size": 2791627,
    "type_description": "Tar file",
    "type_extensions": "tar tar.gz tar.bz2 tar.xz tgz",
    "type_id": 4,
    "type_name": "tar"
  },

But we only want to track the container image archives. In other words, we only want these Koji archive entries:

  {
    "btype": "image",
    "btype_id": 4,
    "build_id": 1930805,
    "buildroot_id": 8460502,
    "checksum": "4393beb4386c6b86edd917d7fe0aab6a",
    "checksum_type": 0,
    "extra": {
      "image": {
        "arch": "ppc64le"
      },
      "docker": { ... snip ... },
    },
    "filename": "docker-image-sha256:fe08ab0d7f0abcaa9f5be66b031822fc132c359f075dd68590fc155b7fe5a330.ppc64le.tar.gz",
    "id": 6121494,
    "metadata_only": false,
    "size": 48535615,
    "type_description": "Tar file",
    "type_extensions": "tar tar.gz tar.bz2 tar.xz tgz",
    "type_id": 4,
    "type_name": "tar"
  },

Koji's listArchives call takes some additional parameters, so there probably some way to filter the archive entries server-side. Looking back at the last time I researched this (for https://pagure.io/koji/pull-request/2609 ) , I think type='image' should work.


Yeah brew --noauth call --json listArchives 1930805 type=image | jq . works in my testing

This happens whenever OSBS uses Cachito for a container, because it uploads the "remote-sources" files as part of the archive.

Here's a container where we did not use Cachito. All the listArchives results are container images.

$ brew --noauth call --json listArchives $(brew --noauth call --json getBuild grafana-container-5-35 | jq ".id") | jq .[].btype
"image"
"image"
"image"

Later we switched that image to Cachito, and now there are "remote-sources" entries:

$ brew --noauth call --json listArchives $(brew --noauth call --json getBuild grafana-container-5-42 | jq ".id") | jq .[].btype
"image"
"image"
"image"
"remote-sources"
"remote-sources"

Metadata Update from @hlin:
- Issue close_status updated to: Fixed
- Issue status updated to: Closed (was: Open)

2 years ago

Login to comment on this ticket.

Metadata
Related Pull Requests
  • #1596 Merged 2 years ago