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

koji: Change release number for NVR #3533

Merged
merged 1 commit into from
Jul 18, 2023
Merged

Conversation

ravanelli
Copy link
Member

  • The release number doesn't need to be random. It make things difficult when we need to search for a NVR name.
  • Let's add a common number in oder to make it easier to search for a NVR when we need to.

dustymabe
dustymabe previously approved these changes Jul 12, 2023
Copy link
Member

@dustymabe dustymabe left a comment

Choose a reason for hiding this comment

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

LGTM - some suggestions in comments

src/cmd-koji-upload Outdated Show resolved Hide resolved
src/cmd-koji-upload Outdated Show resolved Hide resolved
Comment on lines 434 to 435
"release": f"{build.build_id[-1:]}",
"version": f"{build.build_id[:-2]}",
Copy link
Member

Choose a reason for hiding this comment

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

Let's update this to be a little more tolerant if something changes in the future.

For example.. Right now I don't anticipate us ever getting anything other than -0 at the end of a RHCOS build ID, but maybe in the future that could change and we could theoretically get up to -9, -10, etc.

It should be simple to just handle that today if we split based on the -:

[dustymabe@media ~]$ python3
Python 3.11.4 (main, Jun  7 2023, 00:00:00) [GCC 12.3.1 20230508 (Red Hat 12.3.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> build_id='414.92.202307170903-0'
>>> version, release = build_id.split('-')
>>> print(version, release)
414.92.202307170903 0

@@ -429,12 +429,10 @@ class Reserve(_KojiBase):
"""
log.info("Reserving a unique koji id")

Copy link
Member

Choose a reason for hiding this comment

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

since we are now doing something interesting here when it comes to version and release let's add a comment and the top (I'm sorry I know I asked you to remove the release variable in an earlier iteration of this PR:

# The koji/brew NVR is constructed like so:
# Name = "rhcos-$arch", like `rhcos-x86_64`
# Version = Everything before `-` in RHCOS version
# Release = Everything after `-` in RHCOS version
# 
# Example: RHCOS Build ID: 414.92.202307170903-0 for x86_64
#   Name = rhcos-x86_64
#   Version = 414.92.202307170903
#   Release = 0
#   NVR = rhcos-x86_64-414.92.202307170903-0
version, release = build.build_id.split('-')

Comment on lines 653 to 657
"release": f"{self.build.build_id[-1:]}",
"owner": self._owner,
"source": source['origin'],
"start_time": stamp,
# RHCOS wants to be semver-compatible, but Koji doesn't
# accept `-`. See
# https://github.com/openshift/oc/pull/209#issuecomment-564876535
"version": f"{self.build.build_id.replace('-', '.')}"
"version": f"{self.build.build_id[:-2]}"
Copy link
Member

Choose a reason for hiding this comment

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

Need to do something similar to #3533 (comment) here

 - The release number doesn't need to be random.
It makes things difficult when we need to search for
a NVR name.
 - Let's add our "release" version number as release number to
make things easier to search for a NVR when we need to.
Example:
  Our full version number is: 413.92.202302162021.0
  The Brew version is now: 412.86.202302162021 and
the release number is: 0

Signed-off-by: Renata Ravanelli <[email protected]>
Copy link
Member

@dustymabe dustymabe left a comment

Choose a reason for hiding this comment

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

LGTM

@ravanelli ravanelli merged commit f33be69 into coreos:main Jul 18, 2023
2 checks passed
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.

2 participants