code: def sort_annotations(self):
          
  
          all_annotations = self.workflow.build_result.annotations['worker-builds']
          all_platforms = set(all_annotations)
          if len(all_platforms) == 0:
              raise RuntimeError("No worker builds found, cannot group them")
  
          sorted_digests = {}
  
          for plat, annotation in all_annotations.items():
              for digest in annotation['digests']:
                  hostname = registry_hostname(digest['registry'])
                  media_type = get_manifest_media_type(digest['version'])
                  if media_type not in self.manifest_media_types:
                      continue
  
                  platforms = sorted_digests.setdefault(hostname, {})
                  repos = platforms.setdefault(plat, [])
                  repos.append(digest)
  
          sources = {}
          for registry in self.registries:
              registry_conf = self.registries[registry]
              if registry_conf.get('version') == 'v1':
                  continue
  
              hostname = registry_hostname(registry)
              platforms = sorted_digests.get(hostname, {})
  
              if set(platforms) != all_platforms:
                  raise RuntimeError("Missing platforms for registry {}: found {}, expected {}"
                                     .format(registry, sorted(platforms), sorted(all_platforms)))
  
              selected_digests = {}
              for p, repos in platforms.items():
                  selected_digests[p] = sorted(repos, key=lambda d: d['repository'])[0]
  
              sources[registry] = selected_digests
  
          return sources
docs: Return a map of maps to look up a single "worker digest" that has information
          about where to find an image manifest for each registry/architecture combination:
  
            worker_digest = <result>[registry][architecture]