from doozerlib import build_status_detector as bs_detector from doozerlib.cli import cli, pass_runtime from doozerlib.exceptions import DoozerFatalError from doozerlib.util import green_print @click.group( "detect-embargo", short_help= "Check whether one or more images, RPMs, or release payloads have embargoed fixes." ) def detect_embargo(): pass cli.add_command(detect_embargo) @detect_embargo.command("nvr", short_help="Detect embargoed fixes in given builds") @click.option("--yaml", "as_yaml", is_flag=True, help="Print out the result as YAML format.") @click.option("--json", "as_json", is_flag=True, help="Print out the result as JSON format.") @click.argument("nvrs", metavar="NVRS...", nargs=-1, required=True) @pass_runtime def detect_in_nvr(runtime: Runtime, nvrs, as_yaml, as_json):
f"could not determine RHCOS status for {name}: {ex}") return statuses def _tagged_mosc_id(kubeconfig, version, arch, private) -> str: """determine what the most recently tagged machine-os-content is in given imagestream""" base_name = rgp.default_is_base_name(version) base_namespace = rgp.default_is_base_namespace() name, namespace = rgp.is_name_and_space(base_name, base_namespace, arch, private) stdout, _ = exectools.cmd_assert( f"oc --kubeconfig '{kubeconfig}' --namespace '{namespace}' get istag '{name}:machine-os-content'" " --template '{{.image.dockerImageMetadata.Config.Labels.version}}'", retries=3, pollrate=5, strip=True, ) return stdout if stdout else None def _latest_rhcos_build_id(version, arch, private) -> str: """wrapper to return None if anything goes wrong, which will be taken as no change""" try: return rhcos.latest_rhcos_build_id(version, arch, private) except Exception: return None cli.add_command(config_scan_source_changes)