Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

Commit

Permalink
Initial implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
thegreyd committed Jul 30, 2023
1 parent 5d5473a commit 36ad21b
Showing 1 changed file with 28 additions and 3 deletions.
31 changes: 28 additions & 3 deletions elliottlib/cli/find_builds_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
use_default_advisory_option, click_coroutine)
from elliottlib.exceptions import ElliottFatalError
from elliottlib.imagecfg import ImageMetadata
from elliottlib.util import (ensure_erratatool_auth, exit_unauthenticated,
from elliottlib.cli.rhcos_cli import get_build_id_from_rhcos_pullspec
from elliottlib.util import (ensure_erratatool_auth,
get_release_version, green_prefix, green_print,
isolate_el_version_in_brew_tag,
parallel_results_with_progress, pbar_header, progress_func,
Expand Down Expand Up @@ -46,8 +47,8 @@
help='Add build NVR_OR_ID to ADVISORY [MULTIPLE]')
@click.option(
'--kind', '-k', metavar='KIND', required=True,
type=click.Choice(['rpm', 'image']),
help='Find builds of the given KIND [rpm, image]')
type=click.Choice(['rpm', 'image', 'rhcos']),
help='Find builds of the given KIND [rpm, image, rhcos]')
@click.option(
'--from-diff', '--between',
required=False,
Expand Down Expand Up @@ -167,6 +168,30 @@ async def find_builds_cli(runtime: Runtime, advisory, default_advisory_type, bui
non_payload, include_shipped)
elif kind == 'rpm':
unshipped_nvrps = await _fetch_builds_by_kind_rpm(runtime, tag_pv_map, brew_session, include_shipped, member_only)
elif kind == 'rhcos':
rhcos_config = assembly_rhcos_config(runtime.get_releases_config(), runtime.assembly)
build_ids_by_arch = dict()
nvrs = []
for _, tag_config in rhcos_config.items():
for arch, pullspec in tag_config['images'].items():
build_id = get_build_id_from_rhcos_pullspec(pullspec, runtime.logger)
if arch not in build_ids_by_arch:
build_ids_by_arch[arch] = set()
build_ids_by_arch[arch].add(build_id)

for arch, builds in build_ids_by_arch.items():
for build_id in builds:
nvr = f'rhcos-{arch}-{build_id}'
if brew_session.getBuild(nvr):
runtime.logger.info(f'Found rhcos nvr: {nvr}')
nvrs.append(nvr)
else:
runtime.logger.info(f'rhcos nvr not found: {nvr}')

unshipped_nvrps = _fetch_nvrps_by_nvr_or_id(nvrs, tag_pv_map, brew_session=brew_session)

# for all following operations rhcos is equivalent to kind=image
kind = 'image'

pbar_header(
'Fetching builds from Errata: ',
Expand Down

0 comments on commit 36ad21b

Please sign in to comment.