diff --git a/prow/cmd/checkconfig/BUILD.bazel b/prow/cmd/checkconfig/BUILD.bazel index ccde7cf844b5..8e8c92b7788d 100644 --- a/prow/cmd/checkconfig/BUILD.bazel +++ b/prow/cmd/checkconfig/BUILD.bazel @@ -28,6 +28,7 @@ go_library( "//prow/plugins/bugzilla:go_default_library", "//prow/plugins/cherrypickunapproved:go_default_library", "//prow/plugins/hold:go_default_library", + "//prow/plugins/label:go_default_library", "//prow/plugins/lgtm:go_default_library", "//prow/plugins/owners-label:go_default_library", "//prow/plugins/releasenote:go_default_library", diff --git a/prow/cmd/checkconfig/main.go b/prow/cmd/checkconfig/main.go index c67397149c27..318fdaa41575 100644 --- a/prow/cmd/checkconfig/main.go +++ b/prow/cmd/checkconfig/main.go @@ -59,6 +59,7 @@ import ( "k8s.io/test-infra/prow/plugins/bugzilla" "k8s.io/test-infra/prow/plugins/cherrypickunapproved" "k8s.io/test-infra/prow/plugins/hold" + labelplugin "k8s.io/test-infra/prow/plugins/label" "k8s.io/test-infra/prow/plugins/lgtm" ownerslabel "k8s.io/test-infra/prow/plugins/owners-label" "k8s.io/test-infra/prow/plugins/releasenote" @@ -1064,7 +1065,7 @@ func verifyLabelPlugin(label plugins.Label) error { if len(orgRepos) > 0 { sort.Strings(orgRepos) return fmt.Errorf("the following orgs or repos have configuration of %s plugin using the empty string as label name in restricted labels: %s", - verifyowners.PluginName, strings.Join(orgRepos, ", "), + labelplugin.PluginName, strings.Join(orgRepos, ", "), ) } return nil diff --git a/prow/cmd/checkconfig/main_test.go b/prow/cmd/checkconfig/main_test.go index 161abf54bdcc..4fd9f4d5e110 100644 --- a/prow/cmd/checkconfig/main_test.go +++ b/prow/cmd/checkconfig/main_test.go @@ -462,19 +462,19 @@ triggers: // kube/kube: // - size // - config-updater - //config_updater: + // config_updater: // maps: // # Update the plugins configmap whenever plugins.yaml changes // kube/plugins.yaml: // name: plugins // kube/config.yaml: // validation: config - //size: + // size: // s: 1`), // expectedErr: "validation", // }, { - //only one invalid element is printed in the error + // only one invalid element is printed in the error name: "multiple invalid elements", filename: "multiple.yaml", cfg: &plugins.Configuration{}, @@ -2246,7 +2246,7 @@ func TestVerifyLabelPlugin(t *testing.T) { }, }, }, - expectedErrorMsg: "the following orgs or repos have configuration of verify-owners plugin using the empty string as label name in restricted labels: openshift/machine-config-operator", + expectedErrorMsg: "the following orgs or repos have configuration of label plugin using the empty string as label name in restricted labels: openshift/machine-config-operator", }, { name: "valid after removing the restricted labels for the empty string", @@ -2279,7 +2279,7 @@ func TestVerifyLabelPlugin(t *testing.T) { }, }, }, - expectedErrorMsg: "the following orgs or repos have configuration of verify-owners plugin using the empty string as label name in restricted labels: orgRepo1, orgRepo2", + expectedErrorMsg: "the following orgs or repos have configuration of label plugin using the empty string as label name in restricted labels: orgRepo1, orgRepo2", }, } diff --git a/prow/plugins/label/label.go b/prow/plugins/label/label.go index 58f8f3a364ad..f5d835a2f57c 100644 --- a/prow/plugins/label/label.go +++ b/prow/plugins/label/label.go @@ -31,7 +31,9 @@ import ( "k8s.io/test-infra/prow/plugins" ) -const pluginName = "label" +const ( + PluginName = "label" +) var ( defaultLabels = []string{"kind", "priority", "area"} @@ -43,7 +45,7 @@ var ( ) func init() { - plugins.RegisterGenericCommentHandler(pluginName, handleGenericComment, helpProvider) + plugins.RegisterGenericCommentHandler(PluginName, handleGenericComment, helpProvider) } func configString(labels []string) string { @@ -64,7 +66,7 @@ func helpProvider(config *plugins.Configuration, _ []config.OrgRepo) (*pluginhel }, }) if err != nil { - logrus.WithError(err).Warnf("cannot generate comments for %s plugin", pluginName) + logrus.WithError(err).Warnf("cannot generate comments for %s plugin", PluginName) } pluginHelp := &pluginhelp.PluginHelp{ Description: "The label plugin provides commands that add or remove certain types of labels. Labels of the following types can be manipulated: 'area/*', 'committee/*', 'kind/*', 'language/*', 'priority/*', 'sig/*', 'triage/*', and 'wg/*'. More labels can be configured to be used via the /label command.", diff --git a/prow/plugins/label/label_test.go b/prow/plugins/label/label_test.go index f9a34dd8f41a..11a8261a8cf6 100644 --- a/prow/plugins/label/label_test.go +++ b/prow/plugins/label/label_test.go @@ -762,7 +762,7 @@ func TestLabel(t *testing.T) { Repo: github.Repo{Owner: github.User{Login: "org"}, Name: "repo"}, User: github.User{Login: tc.commenter}, } - err := handle(fakeClient, logrus.WithField("plugin", pluginName), plugins.Label{AdditionalLabels: tc.extraLabels, RestrictedLabels: tc.restrictedLabels}, e) + err := handle(fakeClient, logrus.WithField("plugin", PluginName), plugins.Label{AdditionalLabels: tc.extraLabels, RestrictedLabels: tc.restrictedLabels}, e) if err != nil { t.Fatalf("didn't expect error from label test: %v", err) }