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

Fix version comparison in VerifyLatestUpdate #3223

Merged
merged 2 commits into from Aug 25, 2023

Conversation

xmudrii
Copy link
Member

@xmudrii xmudrii commented Aug 24, 2023

What type of PR is this?

/kind bug

What this PR does / why we need it:

We observed that version markers are not getting updated properly on many occasions which is documented in kubernetes/kubernetes#117115

This issue appears when the version marker is supposed to switch from prerelease (rc) to stable. For example: v1.28.0-rc.1.9+3fb5377b25ec51 -> v1.28.0-7+c4e17abb04728e is not going to happen even though left version is lower than right version.

The reason for that is that both v1.28.0-rc.1.9+3fb5377b25ec51 and v1.28.0-7+c4e17abb04728e are considered as "prereleases" by blang/semver library. Version is modeled as:

Version Part v1.28.0-rc.1.9+3fb5377b25ec51 v1.28.0-7+c4e17abb04728e
Major 1 1
Minor 28 28
Patch 0 0
Prerelease [rc, 1, 9] [7]
Build 3fb5377b25ec51 c4e17abb04728e

Comparing versions includes comparing elements in both prerelease slices and that doesn't behave as we would expect in this case.

Given this logic, we always know that:

  • Stable releases are going to have only one element in the prerelease slice
  • Prereleases are going to have two or three elements in the prerelease slice

This can be used when comparing the version to properly switch from prerelease (rc) to stable.

There might be a better approach, but I didn't find such an approach from the blang/semver documentation. Unit tests are added to cover various cases and ensure that this still works as expected.

Which issue(s) this PR fixes:

Fixes kubernetes/kubernetes#117115

Does this PR introduce a user-facing change?

Fix version comparison in VerifyLatestUpdate

/assign @saschagrunert @puerco @jeremyrickard
cc @kubernetes/release-engineering
/hold for discussion

Signed-off-by: Marko Mudrinić <mudrinic.mare@gmail.com>
@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Aug 24, 2023
@k8s-ci-robot k8s-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Aug 24, 2023
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-priority area/release-eng Issues or PRs related to the Release Engineering subproject labels Aug 24, 2023
@k8s-ci-robot k8s-ci-robot added sig/release Categorizes an issue or PR as relevant to SIG Release. approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 24, 2023
@saschagrunert
Copy link
Member

/test pull-release-integration-test

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 25, 2023
@saschagrunert
Copy link
Member

Unfortunately the linter does not seem to be happy with this change.

/lgtm cancel

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 25, 2023
Signed-off-by: Marko Mudrinić <mudrinic.mare@gmail.com>
@xmudrii
Copy link
Member Author

xmudrii commented Aug 25, 2023

/retest
GitHub ratelimit

@xmudrii
Copy link
Member Author

xmudrii commented Aug 25, 2023

@saschagrunert The linter issue should be fixed now.
/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 25, 2023
@xmudrii
Copy link
Member Author

xmudrii commented Aug 25, 2023

/retest
GitHub ratelimit

Copy link
Member

@cpanato cpanato left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 25, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cpanato, saschagrunert, xmudrii

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

The pull request process is described 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

@k8s-ci-robot k8s-ci-robot merged commit 7288ca7 into kubernetes:master Aug 25, 2023
8 of 9 checks passed
@xmudrii xmudrii deleted the fix-release-comparison branch August 25, 2023 10:27
xmudrii added a commit to xmudrii/release that referenced this pull request Sep 7, 2023
…omparison"

This reverts commit 7288ca7, reversing
changes made to 0e27c38.
k8s-ci-robot added a commit that referenced this pull request Sep 7, 2023
Revert "Merge pull request #3223 from xmudrii/fix-release-comparison"
saschagrunert added a commit to saschagrunert/release that referenced this pull request May 14, 2024
Fixing the very specific use case of the failing semver comparison
mentioned in kubernetes/kubernetes#117115

Follow-up on kubernetes#3223 and
kubernetes#3254

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/release-eng Issues or PRs related to the Release Engineering subproject cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/release Categorizes an issue or PR as relevant to SIG Release. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

latest files are not being updated properly
6 participants