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: buggy nextY logic for maxOCPVersion #3416

Conversation

anik120
Copy link
Contributor

@anik120 anik120 commented Oct 18, 2024

The handling logic of versions that are pre-releases by the
nextY() func (that determines the next Y release) was erroneous.

Eg: nextY("4.16.0") returns "4.17" correctly, but nextY("4.16.0-rc1")
returns "4.16" (the correct value is still "4.17").

This PR fixes the nextY function.

Also has improvement for the "not-upgradeable to next OCP" version message.

Description of the change:

Motivation for the change:

Architectural changes:

Testing remarks:

Reviewer Checklist

  • Implementation matches the proposed design, or proposal is updated to match implementation
  • Sufficient unit test coverage
  • Sufficient end-to-end test coverage
  • Bug fixes are accompanied by regression test(s)
  • e2e tests and flake fixes are accompanied evidence of flake testing, e.g. executing the test 100(0) times
  • tech debt/todo is accompanied by issue link(s) in comments in the surrounding code
  • Tests are comprehensible, e.g. Ginkgo DSL is being used appropriately
  • Docs updated or added to /doc
  • Commit messages sensible and descriptive
  • Tests marked as [FLAKE] are truly flaky and have an issue
  • Code is properly formatted

@anik120 anik120 marked this pull request as draft October 18, 2024 17:22
@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 Oct 18, 2024
@openshift-ci openshift-ci bot requested review from benluddy and dtfranz October 18, 2024 17:22
@anik120 anik120 force-pushed the ocpMaxVersion-statement-clarification branch from cddccd8 to 99f83e1 Compare October 22, 2024 12:50
@anik120 anik120 changed the title Clarify the "operator bundle incompatible with maxOCPVersion" error message fix: buggy nextY logic for maxOCPVersion Oct 22, 2024
@anik120 anik120 removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 22, 2024
@anik120 anik120 marked this pull request as ready for review October 22, 2024 12:53
@openshift-ci openshift-ci bot requested review from joelanford and tmshort October 22, 2024 12:53
@anik120 anik120 force-pushed the ocpMaxVersion-statement-clarification branch 3 times, most recently from dca0e03 to 17f6109 Compare October 22, 2024 14:32
Comment on lines 108 to 113
// is it safe to ignore the error here, with the assumption
// that we build a skew object only after verifying that the
// version string is parseable safely.
maxOCPVersion, _ := semver.ParseTolerant(s.maxOpenShiftVersion)
nextY := nextY(maxOCPVersion).String()
return fmt.Sprintf("ClusterServiceVersions blocking upgrade to %s or higher. The maximum supported OCP version for %s/%s is %s", nextY, s.namespace, s.name, s.maxOpenShiftVersion)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For ref, this is where the skew objects are created, where s.maxOpenshiftVersion is set AFTER the value of the field from the CSV is parsed here, and maxOpenshiftVersion() checks that the value is parseable and returns the error if it's not

@gallettilance
Copy link
Member

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Oct 22, 2024
grokspawn
grokspawn previously approved these changes Oct 22, 2024
@anik120 anik120 added this pull request to the merge queue Oct 22, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 22, 2024
// version string is parseable safely.
maxOCPVersion, _ := semver.ParseTolerant(s.maxOpenShiftVersion)
nextY := nextY(maxOCPVersion).String()
return fmt.Sprintf("ClusterServiceVersions blocking upgrade to %s or higher. The maximum supported OCP version for %s/%s is %s", nextY, s.namespace, s.name, s.maxOpenShiftVersion)
Copy link
Member

Choose a reason for hiding this comment

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

Am I reading things correctly that this message is printed for each CSV that is blocking the upgrade. If so, it would be duplicative to repeatedly state in our Upgradeable=False message that "ClusterServiceVersions are blocking minor version upgrades to X.Y+1 or higher"

WDYT about the final message looking something like this?

conditions:
- type: Upgradeable
  status: False
  reason: IncompatibleOperators
  message: |
    ClusterServiceVersions are blocking minor version upgrades to X.Y+1 or higher.
      - openshift-operators/foo is supported through X.Y
      - openshift-operators/bar is supported through X.Y
      - openshift-operators/baz is supported through X.Y

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah good catch. Updated the PR: got the exact format you mentioned, see this

@anik120 anik120 force-pushed the ocpMaxVersion-statement-clarification branch from 17f6109 to a92cbec Compare October 25, 2024 10:34
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Oct 25, 2024
Copy link

openshift-ci bot commented Oct 25, 2024

New changes are detected. LGTM label has been removed.

@@ -105,8 +110,7 @@ func (s skew) String() string {
if s.err != nil {
return fmt.Sprintf("%s/%s has invalid %s properties: %s", s.namespace, s.name, MaxOpenShiftVersionProperty, s.err)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
return fmt.Sprintf("%s/%s has invalid %s properties: %s", s.namespace, s.name, MaxOpenShiftVersionProperty, s.err)
return fmt.Sprintf("- %s/%s has invalid %s properties: %s", s.namespace, s.name, MaxOpenShiftVersionProperty, s.err)

The handling logic of versions that are pre-releases by the
nextY() func (that determines the next Y release) was erroneous.

Eg: nextY("4.16.0") returns "4.17" correctly, but nextY("4.16.0-rc1")
returns "4.16" (the correct value is still "4.17").

This PR fixes the nextY function.

Also has improvement for the "not-upgradeable to next OCP" version message.
@anik120 anik120 force-pushed the ocpMaxVersion-statement-clarification branch from a92cbec to cb9a1d3 Compare October 25, 2024 12:54
@anik120 anik120 added this pull request to the merge queue Oct 28, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 28, 2024
@anik120 anik120 added this pull request to the merge queue Oct 29, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 29, 2024
@anik120 anik120 added this pull request to the merge queue Oct 29, 2024
Merged via the queue into operator-framework:master with commit 27ced56 Oct 29, 2024
12 checks passed
// it is safe to ignore the error here, with the assumption
// that we build each skew object only after verifying that the
// version string is parseable safely.
maxOCPVersion, _ := semver.ParseTolerant(s[0].maxOpenShiftVersion)
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi, will here be panic if the s is an empty slice?

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.

5 participants