Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OCPERT-44 Check kernel tag early-kernel-stop-ship in cmd change-advisory-status #441

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

ming1013
Copy link
Contributor

@ming1013 ming1013 commented Feb 17, 2025

When kernel tag early-kernel-stop-ship is found, stop moving advisory status.

$ python -m unittest tests.test_advisory.TestAdvisoryManager.test_kernel_tag
/home/minl/release-tests/oar/core/util.py:27: DeprecationWarning: Function 'semver.parse_version_info' is deprecated. Deprecated since version 2.10.0. This function will be removed in semver 3. Use 'semver.version.Version.parse' instead.
semver.parse_version_info(version)
/home/minl/release-tests/oar/core/util.py:33: DeprecationWarning: Function 'semver.parse_version_info' is deprecated. Deprecated since version 2.10.0. This function will be removed in semver 3. Use 'semver.version.Version.parse' instead.
version_info = semver.parse_version_info(version)
RHCOS nvr is rhcos-x86_64-417.94.202501150123-0
The commit metadata is kernel-5.14.0-427.51.1.el9_4
Tags of this build is str[{'arches': '', 'id': 121309, 'locked': False, 'maven_include_all': False, 'maven_support': False, 'name': 'early-kernel-candidate', 'perm': None, 'perm_id': None}, {'arches': '', 'id': 121316, 'locked': False, 'maven_include_all': False, 'maven_support': False, 'name': 'early-kernel-stop-ship', 'perm': None, 'perm_id': None}, {'arches': '', 'id': 128179, 'locked': False, 'maven_include_all': False, 'maven_support': False, 'name': 'rhel-9.4.0-z-candidate', 'perm': 'rhel9-gate', 'perm_id': 81}, {'arches': '', 'id': 154307, 'locked': False, 'maven_include_all': False, 'maven_support': False, 'name': 'rhaos-4.19-rhel-9-candidate', 'perm': None, 'perm_id': None}, {'arches': '', 'id': 157969, 'locked': False, 'maven_include_all': False, 'maven_support': False, 'name': 'RHBA-2025:0354-dropped', 'perm': 'trusted', 'perm_id': 6}]
Tag of early-kernel-stop-ship is detected
check kernel tag function skipped, only image advisory need to check.
.

Ran 1 test in 23.937s

OK

Copy link

openshift-ci bot commented Feb 17, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from ming1013. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ming1013 ming1013 requested a review from rioliu-rh February 17, 2025 04:32
@ming1013
Copy link
Contributor Author

@rioliu-rh The oar-check job failed by ModuleNotFoundError: No module named 'jq', how can we install jq in prow python env?

@rioliu-rh
Copy link
Contributor

@rioliu-rh The oar-check job failed by ModuleNotFoundError: No module named 'jq', how can we install jq in prow python env?

dependencies = [

Copy link
Contributor

@tomasdavidorg tomasdavidorg left a comment

Choose a reason for hiding this comment

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

Hi @ming1013,

Just minor structure comments.

Also wouldn't be better to structure the code more. I mean extract some the 3 parts described in the jira to functions to be easily testable or separate the parts by adding some comments?

Copy link

openshift-ci bot commented Feb 20, 2025

@ming1013: all tests passed!

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

# check kernel tag before change advisories' status
ads = am.get_advisories()
for ad in ads:
if Advisory(errata_id=ad.errata_id, impetus=ad.impetus).check_kernel_tag():
Copy link
Contributor

Choose a reason for hiding this comment

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

#Use koji api to query tags of this build
session = koji.ClientSession("https://brewhub.engineering.redhat.com/brewhub")
tags = session.listTags(build=rhos_meta_data)
logger.info(f"Tags of this build is str{tags}")
Copy link
Contributor

@rioliu-rh rioliu-rh Feb 21, 2025

Choose a reason for hiding this comment

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

Suggested change
logger.info(f"Tags of this build is str{tags}")
logger.info(f"Tags of this build is {tags}")

logger.info(f"Tags of this build is str{tags}")
for t in tags:
if t["name"] == 'early-kernel-stop-ship':
logger.info("Tag of early-kernel-stop-ship is detected")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
logger.info("Tag of early-kernel-stop-ship is detected")
logger.info("kernel tag early-kernel-stop-ship is detected")

"""
#Check if impetus is image or not, if it's not image then skip this function.
if self.impetus != AD_IMPETUS_IMAGE:
logger.info("check kernel tag function skipped, only image advisory need to check.")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
logger.info("check kernel tag function skipped, only image advisory need to check.")
logger.info("{self.impetus} advisory does not have RHCOS build, skip checking kernel tag")

Check kernel tag from advisory build image.

Returns:
bool: True if kernel is tagged with early-kernel-stop-ship.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
bool: True if kernel is tagged with early-kernel-stop-ship.
bool: True if kernel build is tagged with early-kernel-stop-ship.

rhos_nvr_url = re.sub(r"-([\d.]+)-(\d+)$", r"/\1/\2", rhos_nvr)
rhos_nvr_url_full = "https://download.eng.bos.redhat.com/brewroot/packages/"+rhos_nvr_url+"/metadata.json"
rhos_meta_data_full = self._get(rhos_nvr_url_full)
rhos_meta_data = [
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
rhos_meta_data = [
kernel_build = [

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants