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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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
@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
@anik120 anik120 force-pushed the ocpMaxVersion-statement-clarification branch 2 times, most recently from 79c1b19 to dca0e03 Compare October 22, 2024 13:57
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 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
@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants