예제 #1
0
def detect_embargoes_in_releases(runtime: Runtime, pullspecs: List[str]):
    """ Finds embargoes in given release payloads
    :param runtime: the runtime
    :param nvrs: list of release pullspecs
    :return: list of Brew build dicts that have embargoed fixes
    """
    runtime.logger.info(
        f"Fetching component pullspecs from {len(pullspecs)} release payloads..."
    )
    ignore_rhcos_tags = rhcos.get_container_names(runtime)
    jobs = runtime.parallel_exec(
        lambda pullspec, _: get_image_pullspecs_from_release_payload(
            pullspec, ignore_rhcos_tags), pullspecs,
        min(len(pullspecs),
            multiprocessing.cpu_count() * 4, 32))
    pullspec_lists = jobs.get()
    embargoed_releases = []
    embargoed_pullspecs = []
    embargoed_builds = []
    for index, image_pullspecs in enumerate(pullspec_lists):
        p, b = detect_embargoes_in_pullspecs(runtime, list(image_pullspecs))
        if p:  # release has embargoes
            embargoed_releases.append(pullspecs[index])
            embargoed_pullspecs += p
            embargoed_builds += b
    return embargoed_releases, embargoed_pullspecs, embargoed_builds
예제 #2
0
def detect_embargoes_in_pullspecs(runtime: Runtime, pullspecs: List[str]):
    """ Finds embargoes in given image pullspecs
    :param runtime: the runtime
    :param nvrs: list of image pullspecs
    :return: list of Brew build dicts that have embargoed fixes
    """
    runtime.logger.info(
        f"Fetching manifests for {len(pullspecs)} pullspecs...")
    jobs = runtime.parallel_exec(
        lambda pullspec, _: get_nvr_by_pullspec(pullspec), pullspecs,
        min(len(pullspecs),
            multiprocessing.cpu_count() * 4, 32))
    nvrs = jobs.get()
    suspect_nvrs = []
    suspect_pullspecs = []
    for index, nvr in enumerate(nvrs):
        n, v, r = nvr
        if not n or not v or not r:
            runtime.logger.warning(
                f"Assuming {pullspecs[index]} is not embargoed because it doesn't have valid NVR labels."
            )
            continue
        suspect_nvrs.append(f"{n}-{v}-{r}")
        suspect_pullspecs.append(pullspecs[index])

    embargoed_builds = detect_embargoes_in_nvrs(runtime, suspect_nvrs)
    embargoed_build_nvrs = {b["nvr"] for b in embargoed_builds}
    embargoed_pullspecs = [
        pullspec for index, pullspec in enumerate(suspect_pullspecs)
        if suspect_nvrs[index] in embargoed_build_nvrs
    ]
    return embargoed_pullspecs, embargoed_builds