@@ -91,7 +91,12 @@ func (s skews) String() string {
91
91
j --
92
92
}
93
93
94
- return "ClusterServiceVersions blocking cluster upgrade: " + strings .Join (msg , "," )
94
+ // it is safe to ignore the error here, with the assumption
95
+ // that we build each skew object only after verifying that the
96
+ // version string is parseable safely.
97
+ maxOCPVersion , _ := semver .ParseTolerant (s [0 ].maxOpenShiftVersion )
98
+ nextY := nextY (maxOCPVersion ).String ()
99
+ return fmt .Sprintf ("ClusterServiceVersions blocking minor version upgrades to %s or higher:\n %s" , nextY , strings .Join (msg , "\n " ))
95
100
}
96
101
97
102
type skew struct {
@@ -103,10 +108,9 @@ type skew struct {
103
108
104
109
func (s skew ) String () string {
105
110
if s .err != nil {
106
- return fmt .Sprintf ("%s/%s has invalid %s properties: %s" , s .namespace , s .name , MaxOpenShiftVersionProperty , s .err )
111
+ return fmt .Sprintf ("- %s/%s has invalid %s properties: %s" , s .namespace , s .name , MaxOpenShiftVersionProperty , s .err )
107
112
}
108
-
109
- return fmt .Sprintf ("%s/%s is incompatible with OpenShift minor versions greater than %s" , s .namespace , s .name , s .maxOpenShiftVersion )
113
+ return fmt .Sprintf ("- maximum supported OCP version for %s/%s is %s" , s .namespace , s .name , s .maxOpenShiftVersion )
110
114
}
111
115
112
116
type transientError struct {
@@ -131,11 +135,6 @@ func incompatibleOperators(ctx context.Context, cli client.Client) (skews, error
131
135
return nil , fmt .Errorf ("failed to determine current OpenShift Y-stream release" )
132
136
}
133
137
134
- next , err := nextY (* current )
135
- if err != nil {
136
- return nil , err
137
- }
138
-
139
138
csvList := & operatorsv1alpha1.ClusterServiceVersionList {}
140
139
if err := cli .List (ctx , csvList ); err != nil {
141
140
return nil , & transientError {fmt .Errorf ("failed to list ClusterServiceVersions: %w" , err )}
@@ -158,7 +157,7 @@ func incompatibleOperators(ctx context.Context, cli client.Client) (skews, error
158
157
continue
159
158
}
160
159
161
- if max == nil || max .GTE (next ) {
160
+ if max == nil || max .GTE (nextY ( * current ) ) {
162
161
continue
163
162
}
164
163
@@ -224,18 +223,8 @@ func getCurrentRelease() (*semver.Version, error) {
224
223
return currentRelease .version , nil
225
224
}
226
225
227
- func nextY (v semver.Version ) (semver.Version , error ) {
228
- v .Build = nil // Builds are irrelevant
229
-
230
- if len (v .Pre ) > 0 {
231
- // Dropping pre-releases is equivalent to incrementing Y
232
- v .Pre = nil
233
- v .Patch = 0
234
-
235
- return v , nil
236
- }
237
-
238
- return v , v .IncrementMinor () // Sets Y=Y+1 and Z=0
226
+ func nextY (v semver.Version ) semver.Version {
227
+ return semver.Version {Major : v .Major , Minor : v .Minor + 1 } // Sets Y=Y+1
239
228
}
240
229
241
230
const (
0 commit comments