コード例 #1
0
 def list_of_current_bom_meta(min_semver, all_bom_meta):
   good_bom_meta = []
   for bom_meta in all_bom_meta:
     semver = SemanticVersion.make('ignored-' + bom_meta['bom_version'])
     if SemanticVersion.compare(semver, min_semver) >= 0:
       good_bom_meta.append(bom_meta)
   return good_bom_meta
コード例 #2
0
  def audit_artifacts(self):
    self.audit_bom_services(self.__all_released_boms, 'released')
    self.audit_bom_services(self.__unreleased_boms, 'unreleased')
    self.audit_package(
        'jar', self.__jar_versions, self.__unused_jars)
    self.audit_package(
        'debian', self.__debian_versions, self.__unused_debians)
    self.audit_package(
        'container', self.__container_versions, self.__unused_containers)
    self.audit_package(
        'image',
        self.__gce_image_versions, self.__unused_gce_images)

    def maybe_write_log(what, data):
      if not data:
        return
      path = os.path.join(self.get_output_dir(), 'audit_' + what + '.yml')
      logging.info('Writing %s', path)
      write_to_path(
          yaml.dump(data, allow_unicode=True, default_flow_style=False),
          path)

    confirmed_boms = self.__all_bom_versions - set(self.__invalid_boms.keys())
    unchecked_releases = [
        key
        for key in self.__all_bom_versions
        if (CollectBomVersions.RELEASED_VERSION_MATCHER.match(key)
            and SemanticVersion.compare(SemanticVersion.make('ignored-' + key),
                                        self.__min_semver) < 0)]

    invalid_releases = {
        key: bom
        for key, bom in self.__invalid_boms.items()
        if (CollectBomVersions.RELEASED_VERSION_MATCHER.match(key)
            and SemanticVersion.compare(SemanticVersion.make('ignored-' + key),
                                        self.__min_semver) >= 0)}
    confirmed_releases = [
        key
        for key in confirmed_boms
        if (CollectBomVersions.RELEASED_VERSION_MATCHER.match(key)
            and SemanticVersion.compare(SemanticVersion.make('ignored-' + key),
                                        self.__min_semver) >= 0)]

    maybe_write_log('missing_debians', self.__missing_debians)
    maybe_write_log('missing_jars', self.__missing_jars)
    maybe_write_log('missing_containers', self.__missing_containers)
    maybe_write_log('missing_images', self.__missing_images)
    maybe_write_log('found_debians', self.__found_debians)
    maybe_write_log('found_jars', self.__found_jars)
    maybe_write_log('found_containers', self.__found_containers)
    maybe_write_log('found_images', self.__found_images)
    maybe_write_log('unused_debians', self.__unused_debians)
    maybe_write_log('unused_jars', self.__unused_jars)
    maybe_write_log('unused_containers', self.__unused_containers)
    maybe_write_log('unused_images', self.__unused_gce_images)
    maybe_write_log('invalid_boms', self.__invalid_boms)
    maybe_write_log('confirmed_boms', sorted(list(confirmed_boms)))
    maybe_write_log('confirmed_releases', sorted(list(confirmed_releases)))
    maybe_write_log('invalid_versions', self.__invalid_versions)
    maybe_write_log('invalid_releases', invalid_releases)
    maybe_write_log('unchecked_releases', unchecked_releases)