You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix CEL validation error message format introduced by Kubernetes v1.35
Kubernetes v1.35 changed CEL validation error message format to include
the actual validated value instead of just the type ("string" or "object").
This provides more helpful error messages for debugging validation failures.
Changes:
- Update test expectations to include actual values in error messages
- Change from "Invalid value: \"string\"" to "Invalid value: \"actual-value\""
- Change from "Invalid value: \"object\"" to "Invalid value:" for object validations
- Update 20+ test cases in TestImageSourceCELValidationRules and related tests
Co-authored-by: Cursor <cursoragent@cursor.com>
"openAPIV3Schema.properties.spec.properties.source.properties.image: Invalid value: cannot specify pollIntervalMinutes while using digest-based image",
42
+
},
43
+
},
44
44
"valid digest based image ref, poll interval not allowed, poll interval not specified": {
"openAPIV3Schema.properties.spec.properties.source.properties.image.ref: Invalid value: \"string\": must start with a valid domain. valid domains must be alphanumeric characters (lowercase and uppercase) separated by the \".\" character.",
56
-
},
50
+
"invalid digest based image ref, invalid domain": {
"openAPIV3Schema.properties.spec.properties.source.properties.image.ref: Invalid value: \"string\": a valid name is required. valid names must contain lowercase alphanumeric characters separated only by the \".\", \"_\", \"__\", \"-\" characters.",
64
-
},
54
+
wantErrs: []string{
55
+
"openAPIV3Schema.properties.spec.properties.source.properties.image.ref: Invalid value: \"-quay+docker/foo/bar@sha256:abcdef123456789abcdef123456789abc\": must start with a valid domain. valid domains must be alphanumeric characters (lowercase and uppercase) separated by the \".\" character.",
65
56
},
66
-
"invalid digest based image ref, invalid digest algorithm": {
"openAPIV3Schema.properties.spec.properties.source.properties.image.ref: Invalid value: \"string\": digest algorithm is not valid. valid algorithms must start with an uppercase or lowercase alpha character followed by alphanumeric characters and may contain the \"-\", \"_\", \"+\", and \".\" characters.",
"invalid digest based image ref, too short digest encoding": {
75
-
spec: ImageSource{
76
-
Ref: "docker.io/foo/bar@sha256:abcdef123456789",
77
-
},
78
-
wantErrs: []string{
79
-
"openAPIV3Schema.properties.spec.properties.source.properties.image.ref: Invalid value: \"string\": digest is not valid. the encoded string must be at least 32 characters",
80
-
},
62
+
wantErrs: []string{
63
+
"openAPIV3Schema.properties.spec.properties.source.properties.image.ref: Invalid value: \"docker.io/FOO/BAR@sha256:abcdef123456789abcdef123456789abc\": a valid name is required. valid names must contain lowercase alphanumeric characters separated only by the \".\", \"_\", \"__\", \"-\" characters.",
81
64
},
82
-
"invalid digest based image ref, invalid characters in digest encoding": {
"openAPIV3Schema.properties.spec.properties.source.properties.image.ref: Invalid value: \"string\": digest is not valid. the encoded string must only contain hex characters (A-F, a-f, 0-9)",
88
-
},
65
+
},
66
+
"invalid digest based image ref, invalid digest algorithm": {
"openAPIV3Schema.properties.spec.properties.source.properties.image.ref: Invalid value: \"string\": must end with a digest or a tag",
96
-
},
70
+
wantErrs: []string{
71
+
"openAPIV3Schema.properties.spec.properties.source.properties.image.ref: Invalid value: \"docker.io/foo/bar@99-problems:abcdef123456789abcdef123456789abc\": digest algorithm is not valid. valid algorithms must start with an uppercase or lowercase alpha character followed by alphanumeric characters and may contain the \"-\", \"_\", \"+\", and \".\" characters.",
"openAPIV3Schema.properties.spec.properties.source.properties.image.ref: Invalid value: \"string\": tag is invalid. the tag must not be more than 127 characters",
104
-
},
73
+
},
74
+
"invalid digest based image ref, too short digest encoding": {
75
+
spec: ImageSource{
76
+
Ref: "docker.io/foo/bar@sha256:abcdef123456789",
105
77
},
106
-
"invalid tag based image ref, tag contains invalid characters": {
107
-
spec: ImageSource{
108
-
Ref: "docker.io/foo/bar:-foo_bar-",
109
-
},
110
-
wantErrs: []string{
111
-
"openAPIV3Schema.properties.spec.properties.source.properties.image.ref: Invalid value: \"string\": tag is invalid. valid tags must begin with a word character (alphanumeric + \"_\") followed by word characters or \".\", and \"-\" characters",
112
-
},
78
+
wantErrs: []string{
79
+
"openAPIV3Schema.properties.spec.properties.source.properties.image.ref: Invalid value: \"docker.io/foo/bar@sha256:abcdef123456789\": digest is not valid. the encoded string must be at least 32 characters",
80
+
},
81
+
},
82
+
"invalid digest based image ref, invalid characters in digest encoding": {
"openAPIV3Schema.properties.spec.properties.source.properties.image.ref: Invalid value: \"docker.io/foo/bar@sha256:XYZxy123456789abcdef123456789abc\": digest is not valid. the encoded string must only contain hex characters (A-F, a-f, 0-9)",
88
+
},
89
+
},
90
+
"invalid image ref, no tag or digest": {
91
+
spec: ImageSource{
92
+
Ref: "docker.io/foo/bar",
93
+
},
94
+
wantErrs: []string{
95
+
"openAPIV3Schema.properties.spec.properties.source.properties.image.ref: Invalid value: \"docker.io/foo/bar\": must end with a digest or a tag",
fmt.Sprintf("openAPIV3Schema.properties.spec.properties.source.properties.image.ref: Invalid value: \"docker.io/foo/bar:%s\": tag is invalid. the tag must not be more than 127 characters", strings.Repeat("x", 128)),
113
104
},
105
+
},
106
+
"invalid tag based image ref, tag contains invalid characters": {
107
+
spec: ImageSource{
108
+
Ref: "docker.io/foo/bar:-foo_bar-",
109
+
},
110
+
wantErrs: []string{
111
+
"openAPIV3Schema.properties.spec.properties.source.properties.image.ref: Invalid value: \"docker.io/foo/bar:-foo_bar-\": tag is invalid. valid tags must begin with a word character (alphanumeric + \"_\") followed by word characters or \".\", and \"-\" characters",
"openAPIV3Schema.properties.spec.properties.source.properties.image.ref: Invalid value: \"string\": a valid name is required. valid names must contain lowercase alphanumeric characters separated only by the \".\", \"_\", \"__\", \"-\" characters.",
133
-
},
127
+
"invalid image ref, only domain with port": {
128
+
spec: ImageSource{
129
+
Ref: "docker.io:8080",
130
+
},
131
+
wantErrs: []string{
132
+
"openAPIV3Schema.properties.spec.properties.source.properties.image.ref: Invalid value: \"docker.io:8080\": a valid name is required. valid names must contain lowercase alphanumeric characters separated only by the \".\", \"_\", \"__\", \"-\" characters.",
"openAPIV3Schema.properties.status.properties.resolvedSource.properties.image.properties.ref: Invalid value: \"string\": must start with a valid domain. valid domains must be alphanumeric characters (lowercase and uppercase) separated by the \".\" character.",
183
-
},
177
+
"invalid digest based image ref, invalid domain": {
"openAPIV3Schema.properties.status.properties.resolvedSource.properties.image.properties.ref: Invalid value: \"string\": a valid name is required. valid names must contain lowercase alphanumeric characters separated only by the \".\", \"_\", \"__\", \"-\" characters.",
191
-
},
181
+
wantErrs: []string{
182
+
"openAPIV3Schema.properties.status.properties.resolvedSource.properties.image.properties.ref: Invalid value: \"-quay+docker/foo/bar@sha256:abcdef123456789abcdef123456789abc\": must start with a valid domain. valid domains must be alphanumeric characters (lowercase and uppercase) separated by the \".\" character.",
192
183
},
193
-
"invalid digest based image ref, invalid digest algorithm": {
"openAPIV3Schema.properties.status.properties.resolvedSource.properties.image.properties.ref: Invalid value: \"string\": digest algorithm is not valid. valid algorithms must start with an uppercase or lowercase alpha character followed by alphanumeric characters and may contain the \"-\", \"_\", \"+\", and \".\" characters.",
"invalid digest based image ref, too short digest encoding": {
202
-
spec: ImageSource{
203
-
Ref: "docker.io/foo/bar@sha256:abcdef123456789",
204
-
},
205
-
wantErrs: []string{
206
-
"openAPIV3Schema.properties.status.properties.resolvedSource.properties.image.properties.ref: Invalid value: \"string\": digest is not valid. the encoded string must be at least 32 characters",
207
-
},
189
+
wantErrs: []string{
190
+
"openAPIV3Schema.properties.status.properties.resolvedSource.properties.image.properties.ref: Invalid value: \"docker.io/FOO/BAR@sha256:abcdef123456789abcdef123456789abc\": a valid name is required. valid names must contain lowercase alphanumeric characters separated only by the \".\", \"_\", \"__\", \"-\" characters.",
208
191
},
209
-
"invalid digest based image ref, invalid characters in digest encoding": {
"openAPIV3Schema.properties.status.properties.resolvedSource.properties.image.properties.ref: Invalid value: \"string\": digest is not valid. the encoded string must only contain hex characters (A-F, a-f, 0-9)",
215
-
},
192
+
},
193
+
"invalid digest based image ref, invalid digest algorithm": {
"openAPIV3Schema.properties.status.properties.resolvedSource.properties.image.properties.ref: Invalid value: \"string\": must end with a digest",
223
-
},
197
+
wantErrs: []string{
198
+
"openAPIV3Schema.properties.status.properties.resolvedSource.properties.image.properties.ref: Invalid value: \"docker.io/foo/bar@99-problems:abcdef123456789abcdef123456789abc\": digest algorithm is not valid. valid algorithms must start with an uppercase or lowercase alpha character followed by alphanumeric characters and may contain the \"-\", \"_\", \"+\", and \".\" characters.",
224
199
},
225
-
"invalid image ref, only domain with port": {
226
-
spec: ImageSource{
227
-
Ref: "docker.io:8080",
228
-
},
229
-
wantErrs: []string{
230
-
"openAPIV3Schema.properties.status.properties.resolvedSource.properties.image.properties.ref: Invalid value: \"string\": a valid name is required. valid names must contain lowercase alphanumeric characters separated only by the \".\", \"_\", \"__\", \"-\" characters.",
231
-
"openAPIV3Schema.properties.status.properties.resolvedSource.properties.image.properties.ref: Invalid value: \"string\": must end with a digest",
232
-
},
200
+
},
201
+
"invalid digest based image ref, too short digest encoding": {
202
+
spec: ImageSource{
203
+
Ref: "docker.io/foo/bar@sha256:abcdef123456789",
233
204
},
234
-
"invalid image ref, tag-based ref": {
235
-
spec: ImageSource{
236
-
Ref: "docker.io/foo/bar:latest",
237
-
},
238
-
wantErrs: []string{
239
-
"openAPIV3Schema.properties.status.properties.resolvedSource.properties.image.properties.ref: Invalid value: \"string\": must end with a digest",
240
-
},
205
+
wantErrs: []string{
206
+
"openAPIV3Schema.properties.status.properties.resolvedSource.properties.image.properties.ref: Invalid value: \"docker.io/foo/bar@sha256:abcdef123456789\": digest is not valid. the encoded string must be at least 32 characters",
207
+
},
208
+
},
209
+
"invalid digest based image ref, invalid characters in digest encoding": {
"openAPIV3Schema.properties.status.properties.resolvedSource.properties.image.properties.ref: Invalid value: \"docker.io/foo/bar@sha256:XYZxy123456789abcdef123456789abc\": digest is not valid. the encoded string must only contain hex characters (A-F, a-f, 0-9)",
215
+
},
216
+
},
217
+
"invalid image ref, no digest": {
218
+
spec: ImageSource{
219
+
Ref: "docker.io/foo/bar",
220
+
},
221
+
wantErrs: []string{
222
+
"openAPIV3Schema.properties.status.properties.resolvedSource.properties.image.properties.ref: Invalid value: \"docker.io/foo/bar\": must end with a digest",
241
223
},
224
+
},
225
+
"invalid image ref, only domain with port": {
226
+
spec: ImageSource{
227
+
Ref: "docker.io:8080",
228
+
},
229
+
wantErrs: []string{
230
+
"openAPIV3Schema.properties.status.properties.resolvedSource.properties.image.properties.ref: Invalid value: \"docker.io:8080\": a valid name is required. valid names must contain lowercase alphanumeric characters separated only by the \".\", \"_\", \"__\", \"-\" characters.",
231
+
"openAPIV3Schema.properties.status.properties.resolvedSource.properties.image.properties.ref: Invalid value: \"docker.io:8080\": must end with a digest",
232
+
},
233
+
},
234
+
"invalid image ref, tag-based ref": {
235
+
spec: ImageSource{
236
+
Ref: "docker.io/foo/bar:latest",
237
+
},
238
+
wantErrs: []string{
239
+
"openAPIV3Schema.properties.status.properties.resolvedSource.properties.image.properties.ref: Invalid value: \"docker.io/foo/bar:latest\": must end with a digest",
0 commit comments