code: def get_metadata(self):
          
          try:
              metadata = get_build_json()["metadata"]
              self.build_id = metadata["name"]
          except KeyError:
              self.log.error("No build metadata")
              raise
  
          for image in self.workflow.tag_conf.unique_images:
              self.pullspec_image = image
              break
  
          for image in self.workflow.tag_conf.primary_images:
              # dash at first/last postition does not count
              if '-' in image.tag[1:-1]:
                  self.pullspec_image = image
                  break
  
          if not self.pullspec_image:
              raise RuntimeError('Unable to determine pullspec_image')
  
          metadata_version = 0
  
          buildroot = self.get_buildroot(build_id=self.build_id)
          output_files = self.get_output(buildroot['id'])
  
          output = [output.metadata for output in output_files]
          koji_metadata = {
              'metadata_version': metadata_version,
              'buildroots': [buildroot],
              'output': output,
          }
          self.update_buildroot_koji(buildroot, output)
  
          return koji_metadata, output_files
docs: Build the metadata needed for importing the build
  
          :return: tuple, the metadata and the list of Output instances