@@ -91,7 +91,12 @@ func (s skews) String() string {
9191 j --
9292 }
9393
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 " ))
95100}
96101
97102type skew struct {
@@ -103,10 +108,9 @@ type skew struct {
103108
104109func (s skew ) String () string {
105110 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 )
107112 }
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 )
110114}
111115
112116type transientError struct {
@@ -131,11 +135,6 @@ func incompatibleOperators(ctx context.Context, cli client.Client) (skews, error
131135 return nil , fmt .Errorf ("failed to determine current OpenShift Y-stream release" )
132136 }
133137
134- next , err := nextY (* current )
135- if err != nil {
136- return nil , err
137- }
138-
139138 csvList := & operatorsv1alpha1.ClusterServiceVersionList {}
140139 if err := cli .List (ctx , csvList ); err != nil {
141140 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
158157 continue
159158 }
160159
161- if max == nil || max .GTE (next ) {
160+ if max == nil || max .GTE (nextY ( * current ) ) {
162161 continue
163162 }
164163
@@ -224,18 +223,8 @@ func getCurrentRelease() (*semver.Version, error) {
224223 return currentRelease .version , nil
225224}
226225
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
239228}
240229
241230const (
0 commit comments