api icon indicating copy to clipboard operation
api copied to clipboard

CSV Validation should check `spec.version` and `metadata.annotations.skipRange`

Open joelanford opened this issue 3 years ago • 2 comments

OLM requires the ClusterServiceVersion's spec.version field to be valid semver (parsable with blang/semver.Parse()). For example,

In opm:

In OLM:

See https://github.com/operator-framework/operator-registry/issues/910

We should add a new validation in the CSV validator to ensure spec.version is set to a string that can be parsed with semver.Parse and metadata.annotations.skipRange is set to a string that can be parsed with semver.ParseRange.

joelanford avatar Feb 18 '22 15:02 joelanford

Just to clarify here, speaking about it with @joelanford:

The case we need to fail on is when that version has a “v” prefix. ParseTolerant allows that, Parse doesn't.

Since it means that the CSV data is invalid shows that ideally this check ought to be in the CSV validator: https://github.com/operator-framework/api/blob/master/pkg/validation/internal/csv.go.

That means we need to add the new check and its tests.

camilamacedo86 avatar Feb 21 '22 11:02 camilamacedo86

c/c @ryantking

camilamacedo86 avatar Feb 23 '22 00:02 camilamacedo86