Add initial SemVer upgrade support#444
Conversation
aacbfba to
0b8465b
Compare
15d9b72 to
40a094f
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #444 +/- ##
==========================================
- Coverage 83.82% 83.64% -0.19%
==========================================
Files 23 23
Lines 847 862 +15
==========================================
+ Hits 710 721 +11
- Misses 94 96 +2
- Partials 43 45 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
f4188c8 to
8d7dc4a
Compare
m1kola
left a comment
There was a problem hiding this comment.
I think it is ready for review now
| } | ||
|
|
||
| // Based on current version create a caret range comparison constraint | ||
| // to allow only major and patch version as successors and exclude current version. |
There was a problem hiding this comment.
Re: "exclude current version" see #444 (comment)
ddc70b2 to
b0c17cb
Compare
b0c17cb to
1e8ed0a
Compare
m1kola
left a comment
There was a problem hiding this comment.
@joelanford please take another look. I updated Makefile to use tags instead of builds.
Also update the PR to address feedback on testing (see comment below).
awgreene
left a comment
There was a problem hiding this comment.
I have a couple of open questions regarding the user experience around 0.minor.patch and 0.0.patch releases, but overall this looks great.
test/e2e/install_test.go
Outdated
| cond := apimeta.FindStatusCondition(operator.Status.Conditions, operatorv1alpha1.TypeResolved) | ||
| g.Expect(cond).ToNot(BeNil()) | ||
| g.Expect(cond.Reason).To(Equal(operatorv1alpha1.ReasonResolutionFailed)) | ||
| g.Expect(cond.Message).To(MatchRegexp(`^constraints not satisfiable:.*; installed package prometheus requires at least one of.*1.2.0[^;]*;.*`)) |
There was a problem hiding this comment.
What does this error message look like in practice?
There was a problem hiding this comment.
It is good that you commented on this line! While working on #469 yesterday I wanted to re-use this regex, but realised that it is too permissive and can give false positives. We should probably use "contains" with exact strings (especially since order of dependencies in the message must be deterministic). Should be easier and more reliable.
I was going to update this PR to be similar to #469, but forgot about it. Will do it now.
Also now I see evem more issues with this regex (e.g. . not being escaped).
Answering your question - the message looks like this:
constraints not satisfiable: installed package prometheus is mandatory; installed package prometheus requires at least one of test-catalog-prometheus-prometheus-operator.1.2.0, test-catalog-prometheus-prometheus-operator.1.0.1, test-catalog-prometheus-prometheus-operator.1.0.0; prometheus package uniqueness permits at most 1 of test-catalog-prometheus-prometheus-operator.2.0.0, test-catalog-prometheus-prometheus-operator.1.2.0, test-catalog-prometheus-prometheus-operator.1.0.1, test-catalog-prometheus-prometheus-operator.1.0.0; required package prometheus is mandatory; required package prometheus requires at least one of test-catalog-prometheus-prometheus-operator.2.0.0
Ideally I want the message to contain only things which failed resolution (similar to pip install) but at the moment we kinda dump everything in here. @perdasilva has experimented with differente approaches to printing errors here. I think we will use this as a starter pack.
I have a bunch of notes from a sync with Per, Joe and Daniel which I need to turn into issues in operator-controller, deppy and catalogd. I'm planing to wrap up efforts related to semver RFC and get back to it.
OLM will now use SemVer to determine next upgrade. In this iteration we only support upgrade within the same major versions: e.g 1.0.1 can be upgraded to 1.0.2 or 1.3.2, but not 2.0.0. Signed-off-by: Mikalai Radchuk <mradchuk@redhat.com>
* Add tests for semver upgrades * Label semver and legacy tests so it is possible to filter one or the other out * Update Makefile to no run legacy tests by default to match default deployment of operator-controller Signed-off-by: Mikalai Radchuk <mradchuk@redhat.com>
1e8ed0a to
9910d29
Compare
m1kola
left a comment
There was a problem hiding this comment.
Updated the PR to get rid of MatchRegexp. Answered some questions.
test/e2e/install_test.go
Outdated
| cond := apimeta.FindStatusCondition(operator.Status.Conditions, operatorv1alpha1.TypeResolved) | ||
| g.Expect(cond).ToNot(BeNil()) | ||
| g.Expect(cond.Reason).To(Equal(operatorv1alpha1.ReasonResolutionFailed)) | ||
| g.Expect(cond.Message).To(MatchRegexp(`^constraints not satisfiable:.*; installed package prometheus requires at least one of.*1.2.0[^;]*;.*`)) |
There was a problem hiding this comment.
It is good that you commented on this line! While working on #469 yesterday I wanted to re-use this regex, but realised that it is too permissive and can give false positives. We should probably use "contains" with exact strings (especially since order of dependencies in the message must be deterministic). Should be easier and more reliable.
I was going to update this PR to be similar to #469, but forgot about it. Will do it now.
Also now I see evem more issues with this regex (e.g. . not being escaped).
Answering your question - the message looks like this:
constraints not satisfiable: installed package prometheus is mandatory; installed package prometheus requires at least one of test-catalog-prometheus-prometheus-operator.1.2.0, test-catalog-prometheus-prometheus-operator.1.0.1, test-catalog-prometheus-prometheus-operator.1.0.0; prometheus package uniqueness permits at most 1 of test-catalog-prometheus-prometheus-operator.2.0.0, test-catalog-prometheus-prometheus-operator.1.2.0, test-catalog-prometheus-prometheus-operator.1.0.1, test-catalog-prometheus-prometheus-operator.1.0.0; required package prometheus is mandatory; required package prometheus requires at least one of test-catalog-prometheus-prometheus-operator.2.0.0
Ideally I want the message to contain only things which failed resolution (similar to pip install) but at the moment we kinda dump everything in here. @perdasilva has experimented with differente approaches to printing errors here. I think we will use this as a starter pack.
I have a bunch of notes from a sync with Per, Joe and Daniel which I need to turn into issues in operator-controller, deppy and catalogd. I'm planing to wrap up efforts related to semver RFC and get back to it.
…e broken demo generation (operator-framework#444) Signed-off-by: Jordan Keister <jordan@nimblewidget.com>
Description
OLM will now use SemVer to determine next upgrade. In this iteration we only support upgrade within the same major versions: e.g 1.0.1 can be upgraded to 1.0.2 or 1.3.2, but not 2.0.0.
Closes #398
Reviewer Checklist