-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UPSTREAM: 30313: remove duplicate errors from aggregate error outputs #10317
UPSTREAM: 30313: remove duplicate errors from aggregate error outputs #10317
Conversation
[test] |
Do not merge until upstream has merged |
1ba3bfd
to
d5d5046
Compare
LGTM if this only suppress a message if they are exactly equal when shown to the user. Sometimes we have a given error message shown multiple times to user (in
|
if errorMsgs.Has(sc.Message) { | ||
continue | ||
} | ||
errorMsgs.Insert(sc.Message) | ||
errs[i] = fmt.Errorf("%s: %s", sc.Field, sc.Message) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the duplicate check needs to include the field, since that's what the user sees
Yeah, this patch only suppresses parts of the error message that repear after |
for i, sc := range scs { | ||
// check for duplicate error messages and skip them | ||
if errorMsgs.Has(sc.Message) { | ||
continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we ever skip because of this, that means errs
has nil errors interspersed, which I would expect to panic when NewAggregate attempts to call Error()
on them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what you want to do is allocate errs with capacity of len(scs), but length 0, then use errs = append(errs, ...)
instead of assigning directly to indexes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch.
d5d5046
to
a7fed0c
Compare
@liggitt Thanks for the feedback!
Done! |
15d970a
to
7770899
Compare
@openshift-bot, the last build failed from the following flakes:
re[test] |
|
@juanvallejo please remove [DO NOT MERGE] if this is good to go. |
one of the commits has a different line count than upstream... is it updated with the merged version from upstream? other than that, looks fine |
Yes, the changes for this commit and the one from upstream are the same. The files (without this patch) already have different line counts: origin, kubernetes EDIT: I misunderstood your comment, there is an extra line-break in this commit: 5705847#diff-45d0049c1caf6801fde2ad4e6b3bb545R157 |
Related BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1257800 Duplicate error messages are sometimes shown when displaying aggregate errors: `$ oc label pod/database-1-fn0r7 qwer1345%$$#=self` ``` * metadata.labels: Invalid value: "qwer1345%5602#": name part must match * the regex ([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9] (e.g. 'MyName' or * 'my.name' or '123-abc') * metadata.labels: Invalid value: "qwer1345%5602#": name part must match * the regex ([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9] (e.g. 'MyName' or * 'my.name' or '123-abc') * metadata.labels: Invalid value: "qwer1345%5602#": name part must match * the regex ([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9] (e.g. 'MyName' or * 'my.name' or '123-abc') ``` This patch removes any duplicate messages (adjacent or not) that appear in the final list of errors.
7770899
to
2061aab
Compare
@juanvallejo I'd also like a negative kind of positive For example in
|
@fabianofranz |
Evaluated for origin test up to 29e7025 |
continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/8364/) |
LGTM [merge] |
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/8364/) (Image: devenv-rhel7_4907) |
Evaluated for origin merge up to 29e7025 |
Related PR: openshift/origin#10317 Related BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1257800#c3 PR kubernetes#10317 fixed duplicate errors for invalid aggregate errors in https://github.com/openshift/origin/blob/master/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/util/helpers.go. However, duplicate aggregate errors that went through https://github.com/openshift/origin/blob/master/vendor/k8s.io/kubernetes/pkg/util/validation/field/errors.go were not affected by that patch. This patch adds duplicate aggregate error checking to `pkg/util/validation/field/errors.go` \##### Before `$ oc set env rc/idling-echo-1 test-abc=1234` ``` error: ReplicationController "idling-echo-1" is invalid: [spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName"] ``` `$ oc set env rc/node-1 test-abc=1234` ``` error: ReplicationController "idling-echo-1" is invalid: [spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName"] ``` \##### After `$ oc set env rc/idling-echo-1 test-abc=1234` ``` error: ReplicationController "idling-echo-1" is invalid: [spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName"] ``` `$ oc set env rc/node-1 test-abc=1234` ``` error: ReplicationController "node-1" is invalid: spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName" ``` :100644 100644 203f7cc... 089f21c... M pkg/util/validation/field/errors.go
Related PR: openshift#10317 Related BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1257800#c3 PR openshift#10317 fixed duplicate errors for invalid aggregate errors in https://github.com/openshift/origin/blob/master/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/util/helpers.go. However, duplicate aggregate errors that went through https://github.com/openshift/origin/blob/master/vendor/k8s.io/kubernetes/pkg/util/validation/field/errors.go were not affected by that patch. This patch adds duplicate aggregate error checking to `pkg/util/validation/field/errors.go` \##### Before `$ oc set env rc/idling-echo-1 test-abc=1234` ``` error: ReplicationController "idling-echo-1" is invalid: [spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName"] ``` `$ oc set env rc/node-1 test-abc=1234` ``` error: ReplicationController "idling-echo-1" is invalid: [spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName"] ``` \##### After `$ oc set env rc/idling-echo-1 test-abc=1234` ``` error: ReplicationController "idling-echo-1" is invalid: [spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName"] ``` `$ oc set env rc/node-1 test-abc=1234` ``` error: ReplicationController "node-1" is invalid: spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName" ```
Related PR: openshift/origin#10317 Related BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1257800#c3 PR kubernetes#10317 fixed duplicate errors for invalid aggregate errors in https://github.com/openshift/origin/blob/master/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/util/helpers.go. However, duplicate aggregate errors that went through https://github.com/openshift/origin/blob/master/vendor/k8s.io/kubernetes/pkg/util/validation/field/errors.go were not affected by that patch. This patch adds duplicate aggregate error checking to `pkg/util/validation/field/errors.go` \##### Before `$ oc set env rc/idling-echo-1 test-abc=1234` ``` error: ReplicationController "idling-echo-1" is invalid: [spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName"] ``` `$ oc set env rc/node-1 test-abc=1234` ``` error: ReplicationController "idling-echo-1" is invalid: [spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName"] ``` \##### After `$ oc set env rc/idling-echo-1 test-abc=1234` ``` error: ReplicationController "idling-echo-1" is invalid: [spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName"] ``` `$ oc set env rc/node-1 test-abc=1234` ``` error: ReplicationController "node-1" is invalid: spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName" ``` :100644 100644 203f7cc... 089f21c... M pkg/util/validation/field/errors.go
Related PR: openshift/origin#10317 Related BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1257800#c3 PR kubernetes#10317 fixed duplicate errors for invalid aggregate errors in https://github.com/openshift/origin/blob/master/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/util/helpers.go. However, duplicate aggregate errors that went through https://github.com/openshift/origin/blob/master/vendor/k8s.io/kubernetes/pkg/util/validation/field/errors.go were not affected by that patch. This patch adds duplicate aggregate error checking to `pkg/util/validation/field/errors.go` \##### Before `$ oc set env rc/idling-echo-1 test-abc=1234` ``` error: ReplicationController "idling-echo-1" is invalid: [spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName"] ``` `$ oc set env rc/node-1 test-abc=1234` ``` error: ReplicationController "idling-echo-1" is invalid: [spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName"] ``` \##### After `$ oc set env rc/idling-echo-1 test-abc=1234` ``` error: ReplicationController "idling-echo-1" is invalid: [spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName"] ``` `$ oc set env rc/node-1 test-abc=1234` ``` error: ReplicationController "node-1" is invalid: spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName" ``` :100644 100644 203f7cc... 089f21c... M pkg/util/validation/field/errors.go
Related PR: openshift/origin#10317 Related BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1257800#c3 PR kubernetes#10317 fixed duplicate errors for invalid aggregate errors in https://github.com/openshift/origin/blob/master/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/util/helpers.go. However, duplicate aggregate errors that went through https://github.com/openshift/origin/blob/master/vendor/k8s.io/kubernetes/pkg/util/validation/field/errors.go were not affected by that patch. This patch adds duplicate aggregate error checking to `pkg/util/validation/field/errors.go` \##### Before `$ oc set env rc/idling-echo-1 test-abc=1234` ``` error: ReplicationController "idling-echo-1" is invalid: [spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName"] ``` `$ oc set env rc/node-1 test-abc=1234` ``` error: ReplicationController "idling-echo-1" is invalid: [spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName"] ``` \##### After `$ oc set env rc/idling-echo-1 test-abc=1234` ``` error: ReplicationController "idling-echo-1" is invalid: [spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName"] ``` `$ oc set env rc/node-1 test-abc=1234` ``` error: ReplicationController "node-1" is invalid: spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName" ``` :100644 100644 203f7cc... 089f21c... M pkg/util/validation/field/errors.go
Related PR: openshift#10317 Related BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1257800#c3 PR openshift#10317 fixed duplicate errors for invalid aggregate errors in https://github.com/openshift/origin/blob/master/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/util/helpers.go. However, duplicate aggregate errors that went through https://github.com/openshift/origin/blob/master/vendor/k8s.io/kubernetes/pkg/util/validation/field/errors.go were not affected by that patch. This patch adds duplicate aggregate error checking to `pkg/util/validation/field/errors.go` \##### Before `$ oc set env rc/idling-echo-1 test-abc=1234` ``` error: ReplicationController "idling-echo-1" is invalid: [spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName"] ``` `$ oc set env rc/node-1 test-abc=1234` ``` error: ReplicationController "idling-echo-1" is invalid: [spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName"] ``` \##### After `$ oc set env rc/idling-echo-1 test-abc=1234` ``` error: ReplicationController "idling-echo-1" is invalid: [spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName"] ``` `$ oc set env rc/node-1 test-abc=1234` ``` error: ReplicationController "node-1" is invalid: spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName" ```
Related PR: openshift/origin#10317 Related BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1257800#c3 PR kubernetes#10317 fixed duplicate errors for invalid aggregate errors in https://github.com/openshift/origin/blob/master/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/util/helpers.go. However, duplicate aggregate errors that went through https://github.com/openshift/origin/blob/master/vendor/k8s.io/kubernetes/pkg/util/validation/field/errors.go were not affected by that patch. This patch adds duplicate aggregate error checking to `pkg/util/validation/field/errors.go` \##### Before `$ oc set env rc/idling-echo-1 test-abc=1234` ``` error: ReplicationController "idling-echo-1" is invalid: [spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName"] ``` `$ oc set env rc/node-1 test-abc=1234` ``` error: ReplicationController "idling-echo-1" is invalid: [spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName"] ``` \##### After `$ oc set env rc/idling-echo-1 test-abc=1234` ``` error: ReplicationController "idling-echo-1" is invalid: [spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName"] ``` `$ oc set env rc/node-1 test-abc=1234` ``` error: ReplicationController "node-1" is invalid: spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName" ``` :100644 100644 203f7cc... 089f21c... M pkg/util/validation/field/errors.go
Related PR: openshift/origin#10317 Related BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1257800#c3 PR kubernetes#10317 fixed duplicate errors for invalid aggregate errors in https://github.com/openshift/origin/blob/master/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/util/helpers.go. However, duplicate aggregate errors that went through https://github.com/openshift/origin/blob/master/vendor/k8s.io/kubernetes/pkg/util/validation/field/errors.go were not affected by that patch. This patch adds duplicate aggregate error checking to `pkg/util/validation/field/errors.go` \##### Before `$ oc set env rc/idling-echo-1 test-abc=1234` ``` error: ReplicationController "idling-echo-1" is invalid: [spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName"] ``` `$ oc set env rc/node-1 test-abc=1234` ``` error: ReplicationController "idling-echo-1" is invalid: [spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName"] ``` \##### After `$ oc set env rc/idling-echo-1 test-abc=1234` ``` error: ReplicationController "idling-echo-1" is invalid: [spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName"] ``` `$ oc set env rc/node-1 test-abc=1234` ``` error: ReplicationController "node-1" is invalid: spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName" ``` :100644 100644 203f7cc... 089f21c... M pkg/util/validation/field/errors.go
Related PR: openshift/origin#10317 Related BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1257800#c3 PR kubernetes#10317 fixed duplicate errors for invalid aggregate errors in https://github.com/openshift/origin/blob/master/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/util/helpers.go. However, duplicate aggregate errors that went through https://github.com/openshift/origin/blob/master/vendor/k8s.io/kubernetes/pkg/util/validation/field/errors.go were not affected by that patch. This patch adds duplicate aggregate error checking to `pkg/util/validation/field/errors.go` \##### Before `$ oc set env rc/idling-echo-1 test-abc=1234` ``` error: ReplicationController "idling-echo-1" is invalid: [spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName"] ``` `$ oc set env rc/node-1 test-abc=1234` ``` error: ReplicationController "idling-echo-1" is invalid: [spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName"] ``` \##### After `$ oc set env rc/idling-echo-1 test-abc=1234` ``` error: ReplicationController "idling-echo-1" is invalid: [spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName"] ``` `$ oc set env rc/node-1 test-abc=1234` ``` error: ReplicationController "node-1" is invalid: spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName" ``` :100644 100644 203f7cc... 089f21c... M pkg/util/validation/field/errors.go
Related PR: openshift/origin#10317 Related BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1257800#c3 PR kubernetes#10317 fixed duplicate errors for invalid aggregate errors in https://github.com/openshift/origin/blob/master/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/util/helpers.go. However, duplicate aggregate errors that went through https://github.com/openshift/origin/blob/master/vendor/k8s.io/kubernetes/pkg/util/validation/field/errors.go were not affected by that patch. This patch adds duplicate aggregate error checking to `pkg/util/validation/field/errors.go` \##### Before `$ oc set env rc/idling-echo-1 test-abc=1234` ``` error: ReplicationController "idling-echo-1" is invalid: [spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName"] ``` `$ oc set env rc/node-1 test-abc=1234` ``` error: ReplicationController "idling-echo-1" is invalid: [spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName"] ``` \##### After `$ oc set env rc/idling-echo-1 test-abc=1234` ``` error: ReplicationController "idling-echo-1" is invalid: [spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName"] ``` `$ oc set env rc/node-1 test-abc=1234` ``` error: ReplicationController "node-1" is invalid: spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName" ``` :100644 100644 203f7cc... 089f21c... M pkg/util/validation/field/errors.go
Related PR: openshift/origin#10317 Related BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1257800#c3 PR kubernetes#10317 fixed duplicate errors for invalid aggregate errors in https://github.com/openshift/origin/blob/master/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/util/helpers.go. However, duplicate aggregate errors that went through https://github.com/openshift/origin/blob/master/vendor/k8s.io/kubernetes/pkg/util/validation/field/errors.go were not affected by that patch. This patch adds duplicate aggregate error checking to `pkg/util/validation/field/errors.go` \##### Before `$ oc set env rc/idling-echo-1 test-abc=1234` ``` error: ReplicationController "idling-echo-1" is invalid: [spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName"] ``` `$ oc set env rc/node-1 test-abc=1234` ``` error: ReplicationController "idling-echo-1" is invalid: [spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName"] ``` \##### After `$ oc set env rc/idling-echo-1 test-abc=1234` ``` error: ReplicationController "idling-echo-1" is invalid: [spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName"] ``` `$ oc set env rc/node-1 test-abc=1234` ``` error: ReplicationController "node-1" is invalid: spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName" ``` :100644 100644 203f7cc... 089f21c... M pkg/util/validation/field/errors.go
Related BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1257800
UPSTREAM: kubernetes/kubernetes#30313
Duplicate error messages are sometimes shown when displaying aggregate
errors:
$ oc label pod/database-1-fn0r7 qwer1345%$$#=self
This patch removes any duplicate messages (adjacent or not) that appear
in the final list of errors.
Before
$ oc label pod/database-1-fn0r7 qwer1345%$$#=self
After
$ oc label pod/database-1-fn0r7 qwer1345%$$#=self
cc @fabianofranz