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

Commit

Permalink
nightlies: Minor refactoring in prep for new format coreos image
Browse files Browse the repository at this point in the history
https://github.com/coreos/enhancements/blob/main/os/coreos-layering.md
will add a new image that will replace `machine-os-content`; this
is some minor cleanup/refactoring in preparation for that.
  • Loading branch information
cgwalters committed Jun 21, 2022
1 parent 93b8be5 commit c9feec3
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions doozerlib/cli/get_nightlies.py
Expand Up @@ -5,6 +5,10 @@
from doozerlib.cli import cli
from doozerlib import constants, util, exectools

# See https://github.com/openshift/machine-config-operator/blob/master/docs/OSUpgrades.md
# But in the future this will be replaced, see https://github.com/coreos/enhancements/blob/main/os/coreos-layering.md
OLD_FORMAT_COREOS_TAG = 'machine-os-content'


@cli.command("get-nightlies", short_help="Get sets of Accepted nightlies. A set contains nightly for each arch, "
"determined by closest timestamps")
Expand Down Expand Up @@ -52,7 +56,7 @@ def ignore_arch(arch):
nightly_str = f'{nightly} {phase}'
if rhcos:
if phase != 'Pending':
rhcos = get_build_from_payload(get_nightly_pullspec(nightly, arch))
rhcos = get_coreos_build_from_payload(get_nightly_pullspec(nightly, arch))
nightly_str += f' {rhcos}'
print(nightly_str)
print(",".join(nightly_set))
Expand All @@ -64,9 +68,9 @@ def get_nightly_pullspec(release, arch):
return f'registry.ci.openshift.org/ocp{suffix}/release{suffix}:{release}'


def get_build_from_payload(payload_pullspec):
rhcos_tag = 'machine-os-content'
out, err = exectools.cmd_assert(["oc", "adm", "release", "info", "--image-for", rhcos_tag, "--", payload_pullspec])
def get_coreos_build_from_payload(payload_pullspec):
"""Retrive the build version of machine-os-content (e.g. 411.86.202206131434-0)"""
out, err = exectools.cmd_assert(["oc", "adm", "release", "info", "--image-for", OLD_FORMAT_COREOS_TAG, "--", payload_pullspec])
if err:
raise Exception(f"Error running oc adm: {err}")
rhcos_pullspec = out.split('\n')[0]
Expand Down

0 comments on commit c9feec3

Please sign in to comment.