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

[ART-3883] multiple rhcos containers #618

Merged
merged 10 commits into from Jul 19, 2022

Conversation

sosiouxme
Copy link
Contributor

@sosiouxme sosiouxme commented Jul 5, 2022

https://issues.redhat.com/browse/ART-3883

We will need to configurably inject multiple containers from an RHCOS build into the payload. Eventually machine-os-content may not be the reference container and may not be present at all. https://github.com/openshift/ocp-build-data/pull/1773/files shows how we might expect config to look for the first additional container. openshift-eng/ocp-build-data-validator#78 enables rhel-coreos-8 in assembly definitions.

If the changes seem a bit much to review, it will likely be easier to review one commit at a time, as each represents a discrete change.

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 5, 2022
@openshift-ci openshift-ci bot requested a review from Ximinhan July 5, 2022 18:00
@openshift-eng openshift-eng deleted a comment from openshift-bot Jul 5, 2022
@cgwalters
Copy link
Contributor

Thanks so much for working on this! I am not familiar with the codebase, but at a superficial level the changes LGTM.

One other note; the current plan(ish) calls not just for potentially having rhel-coreos-8 and rhel-coreos-9 - we also want a separate rhel-coreos-8-extensions container (xref openshift/os#763 ).

Even further, I think things may be cleaner if we introduce a separate rhel-coreos-rt-8 (i.e. RT kernel).

@sosiouxme sosiouxme changed the title [WIP][ART-3883] multiple rhcos containers [ART-3883] multiple rhcos containers Jul 8, 2022
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 8, 2022
@openshift-eng openshift-eng deleted a comment from openshift-bot Jul 10, 2022
@openshift-eng openshift-eng deleted a comment from openshift-bot Jul 10, 2022
@openshift-eng openshift-eng deleted a comment from openshift-bot Jul 10, 2022
@openshift-eng openshift-eng deleted a comment from openshift-bot Jul 10, 2022


def rhcos_content_tag(runtime) -> str:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

turns out nothing references this; we may need to resurrect it somehow when RHCOS is building for rhel8 and rhel9.

Comment on lines +900 to +901
@classmethod
def find_payload_entries(clazz, assembly_inspector: AssemblyInspector, arch: str, dest_repo: str) -> (Dict[str, PayloadEntry], List[AssemblyIssue]):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i broke this method up because it was impossible to unit test. i only ended up unit testing the new stuff but more tests are welcome :)

@openshift-eng openshift-eng deleted a comment from openshift-bot Jul 14, 2022
@openshift-eng openshift-eng deleted a comment from openshift-bot Jul 14, 2022
for arch in runtime.arches:
if arch not in mosc_by_arch:
if arch not in rhcos_by_tag[list(rhcos_tag_names)[0]]:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

list(rhcos_tag_names)[0] is nondeterministic. It could be any RHCOS tag name defined in group.yml.
Should we check all tags (or the primary tag)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

currently they should all be from the same RHCOS builds so it shouldn't matter which we get. but admittedly this does look weird, and will be clearer if i just use the primary tag.

else:
exit_with_error(f'Did not find machine-os-content image for active group architecture: {arch}')
exit_with_error(f'Did not find RHCOS container image for active group architecture: {arch}')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would like to include the tag name in the error message.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes this easier too :)


def get_container_names(runtime):
return {tag.name for tag in get_container_configs(runtime)}
"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docstring is after return.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

heh. oops! 👍

for tag in get_container_configs(runtime):
if tag.primary:
return tag
raise Exception("Need to provide a group.yml rhcos.payload_tags entry with primary=true")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be less generic, like ValueError:

Suggested change
raise Exception("Need to provide a group.yml rhcos.payload_tags entry with primary=true")
raise ValueError("Need to provide a group.yml rhcos.payload_tags entry with primary=true")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if i care at all what type of exception is raised, i'll generally define one specifically for it, so i can test for it. i don't think i care here...

Copy link
Contributor

@vfreex vfreex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally LGTM. Just have some nits and questions.

@@ -265,30 +265,30 @@ def _detect_rhcos_status(runtime, kubeconfig) -> list:
for arch in runtime.arches:
for private in (False, True):
name = f"{version}-{arch}{'-priv' if private else ''}"
tagged_mosc_id = _tagged_mosc_id(kubeconfig, version, arch, private)
tagged_rhcos_id = _tagged_rhcos_id(kubeconfig, rhcos.get_primary_container_name(runtime), version, arch, private)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to check other tags? Are they guaranteed to be updated at the same time?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the same RHCOS build supplies all the containers in the payload, so we should only need to check one.

i'll need to make sure that continues to be the case when we re-introduce gating RHCOS inclusion on CI tests.

this will get more complicated when we have multiple RHCOS builds to include, but we'll cross that bridge later.

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 18, 2022
Copy link
Contributor Author

@sosiouxme sosiouxme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vfreex thanks! i also found another minor bug to fix while testing suggested changes... will update

for arch in runtime.arches:
if arch not in mosc_by_arch:
if arch not in rhcos_by_tag[list(rhcos_tag_names)[0]]:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

currently they should all be from the same RHCOS builds so it shouldn't matter which we get. but admittedly this does look weird, and will be clearer if i just use the primary tag.

else:
exit_with_error(f'Did not find machine-os-content image for active group architecture: {arch}')
exit_with_error(f'Did not find RHCOS container image for active group architecture: {arch}')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes this easier too :)

@@ -265,30 +265,30 @@ def _detect_rhcos_status(runtime, kubeconfig) -> list:
for arch in runtime.arches:
for private in (False, True):
name = f"{version}-{arch}{'-priv' if private else ''}"
tagged_mosc_id = _tagged_mosc_id(kubeconfig, version, arch, private)
tagged_rhcos_id = _tagged_rhcos_id(kubeconfig, rhcos.get_primary_container_name(runtime), version, arch, private)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the same RHCOS build supplies all the containers in the payload, so we should only need to check one.

i'll need to make sure that continues to be the case when we re-introduce gating RHCOS inclusion on CI tests.

this will get more complicated when we have multiple RHCOS builds to include, but we'll cross that bridge later.


def get_container_names(runtime):
return {tag.name for tag in get_container_configs(runtime)}
"""
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

heh. oops! 👍

for tag in get_container_configs(runtime):
if tag.primary:
return tag
raise Exception("Need to provide a group.yml rhcos.payload_tags entry with primary=true")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if i care at all what type of exception is raised, i'll generally define one specifically for it, so i can test for it. i don't think i care here...

@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 18, 2022
@openshift-eng openshift-eng deleted a comment from openshift-bot Jul 18, 2022
@openshift-bot
Copy link

Build #10

GLOB sdist-make: /mnt/workspace/jenkins/working/art-tools_doozer_PR-618/setup.py
py36 inst-nodeps: /mnt/workspace/jenkins/working/art-tools_doozer_PR-618/.tox/.tmp/package/1/rh-doozer-2.0.15.dev76+gca9baa9.zip
py36 installed: aiofiles==0.8.0,astroid==2.11.6,attrs==21.4.0,autopep8==1.6.0,bashlex==0.16,bcrypt==3.2.2,cached-property==1.5.2,certifi==2022.6.15,cffi==1.15.1,charset-normalizer==2.0.12,click==8.0.4,contextvars==2.4,coverage==6.2,cryptography==37.0.4,dataclasses==0.8,decorator==5.1.1,Deprecated==1.2.13,dill==0.3.4,distlib==0.3.4,dockerfile-parse==1.2.0,filelock==3.4.1,flake8==4.0.1,flexmock==0.11.3,future==0.18.2,gssapi==1.7.3,idna==3.3,immutables==0.18,importlib-metadata==4.8.3,importlib-resources==5.4.0,iniconfig==1.1.1,isort==5.10.1,koji==1.29.0,krb5==0.3.0,lazy-object-proxy==1.7.1,mccabe==0.6.1,mock==4.0.3,mysql-connector-python==8.0.29,openshift-client==1.0.17,packaging==21.3,paramiko==2.11.0,platformdirs==2.4.0,pluggy==1.0.0,protobuf==3.19.4,py==1.11.0,pycodestyle==2.8.0,pycparser==2.21,pyflakes==2.4.0,pygit2==1.6.1,PyGithub==1.55,PyJWT==2.4.0,pylint==2.13.9,PyNaCl==1.5.0,pyparsing==3.0.9,pyspnego==0.5.2,pytest==7.0.1,python-dateutil==2.8.2,PyYAML==6.0,requests==2.27.1,requests-gssapi==1.2.3,requests-kerberos==0.14.0,rh-doozer @ file:///mnt/workspace/jenkins/working/art-tools_doozer_PR-618/.tox/.tmp/package/1/rh-doozer-2.0.15.dev76%2Bgca9baa9.zip,semver==2.13.0,setuptools-scm==6.4.2,six==1.16.0,tenacity==8.0.1,toml==0.10.2,tomli==1.2.3,tox==3.25.1,typed-ast==1.5.4,typing==3.7.4.3,typing-extensions==4.1.1,urllib3==1.26.9,virtualenv==20.15.1,wrapt==1.14.1,zipp==3.6.0
py36 run-test-pre: PYTHONHASHSEED='895658759'
py36 run-test: commands[0] | coverage run --branch --source doozerlib -m unittest discover -t . -s tests/
/mnt/workspace/jenkins/working/art-tools_doozer_PR-618/.tox/py36/lib/python3.6/site-packages/mysql/connector/authentication.py:44: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography and will be removed in a future release.
  from cryptography.exceptions import UnsupportedAlgorithm
..............................................................................s.s....................................s.s...s.s.s..s.s.s........................................................................
----------------------------------------------------------------------
Ran 197 tests in 8.555s

OK (skipped=10)
py36 run-test: commands[1] | flake8
py36 run-test: commands[2] | coverage report
Name                                          Stmts   Miss Branch BrPart  Cover
-------------------------------------------------------------------------------
doozerlib/__init__.py                             9      2      2      1    73%
doozerlib/assembly.py                           162     43     97      8    70%
doozerlib/assembly_inspector.py                 177    158    102      0     8%
doozerlib/assertion.py                           13      0      6      0   100%
doozerlib/brew.py                               345    200    162      4    40%
doozerlib/build_status_detector.py               85     10     56      3    87%
doozerlib/cli/__init__.py                       101     45     20      0    46%
doozerlib/cli/__main__.py                      1126   1126    468      0     0%
doozerlib/cli/cli_opts.py                        15      3      6      0    86%
doozerlib/cli/config_plashet.py                 533    533    248      0     0%
doozerlib/cli/detect_embargo.py                 164     35     70      8    75%
doozerlib/cli/get_nightlies.py                   91     91     36      0     0%
doozerlib/cli/images_health.py                   81     30     26      2    59%
doozerlib/cli/images_streams.py                 617    617    264      0     0%
doozerlib/cli/inspect_stream.py                  45     45     14      0     0%
doozerlib/cli/release_calc_upgrade_tests.py      23     23      6      0     0%
doozerlib/cli/release_gen_assembly.py           213    213    110      0     0%
doozerlib/cli/release_gen_payload.py            535    439    260      0    13%
doozerlib/cli/rpms_build.py                     165     59     58      8    57%
doozerlib/cli/scan_sources.py                   180    139     96      2    17%
doozerlib/config.py                              97     97     46      0     0%
doozerlib/constants.py                           10      0      0      0   100%
doozerlib/coverity.py                           245    215     76      0    10%
doozerlib/dblib.py                              250    154     74      4    36%
doozerlib/distgit.py                           1445    916    699     38    35%
doozerlib/dotconfig.py                           54     43     33      0    15%
doozerlib/exceptions.py                           2      0      2      0   100%
doozerlib/exectools.py                          192    103     78     10    43%
doozerlib/gitdata.py                            171    137     86      0    17%
doozerlib/image.py                              492    324    220      6    28%
doozerlib/logutil.py                              9      0      4      1    92%
doozerlib/metadata.py                           438    161    212     30    58%
doozerlib/model.py                              110     21     44      2    82%
doozerlib/olm/__init__.py                         0      0      0      0   100%
doozerlib/olm/bundle.py                         293    215     72      3    23%
doozerlib/plashet.py                            134      9     92     15    89%
doozerlib/pushd.py                               20      2      4      0    92%
doozerlib/repos.py                              206    105    117     17    45%
doozerlib/rhcos.py                              170     33     62     10    76%
doozerlib/rpm_builder.py                        232     31    125     32    81%
doozerlib/rpm_utils.py                          134     33     90     11    74%
doozerlib/rpmcfg.py                             143     58     62      8    55%
doozerlib/runtime.py                            912    668    376      8    21%
doozerlib/source_modifications.py               111     29     34      4    73%
doozerlib/state.py                               23     12     10      0    39%
doozerlib/util.py                               410    207    154      5    46%
-------------------------------------------------------------------------------
TOTAL                                         10983   7384   4879    240    30%
___________________________________ summary ____________________________________
  py36: commands succeeded
  congratulations :)

@openshift-eng openshift-eng deleted a comment from openshift-bot Jul 19, 2022
Copy link
Contributor

@vfreex vfreex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jul 19, 2022
@sosiouxme sosiouxme merged commit cbb0ec7 into openshift-eng:master Jul 19, 2022
@sosiouxme sosiouxme deleted the 20220701-multi-rhcos branch July 19, 2022 13:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants