-
Notifications
You must be signed in to change notification settings - Fork 132
plugin/label: Improve error when adding/removing a restricted label #469
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
It's confusing. We also unify the error message with other similar errors messages and modify existing tests to validate the actual string. Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Provide a breadcrumb to users if they are unable to assign a label *and* there are no allowed_teams configured. Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: stephenfin The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
✅ Deploy Preview for k8s-prow ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
/test pull-prow-integration That...doesn't look related... |
@stephenfin: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
/retest-required
|
I see no reason why the message can't display the allowed teams and (a subset of) the allowed users as well. You can format a GH message so that it hides content by default to be expanded, maybe if the list is longer than 5 or so you can put an ellipsis, and hide the rest behind it. I am not sure that I would bother with returning random users. In situations where there are 20+ users, maybe just return the first 20... WDYT? |
Currently, if you attempt to add a restricted label and
allowed_teams
is unset/empty, you get the following unhelpful message.Improve this so that we no longer suggest being a member of no team and instead suggest reaching out to one of the users in
allowed_users
instead:We also improve the common path where
allowed_teams
is populated, aligning the error message with those of other errors paths:Note
I suspect dumping a list of users could get "chatty", so I've intentionally avoided formatting these as links (i.e. we emit
user
, not@user
) and only print up to 3 users. In most cases, this code should not be triggered since projects will usually make use ofallowed_teams
.Note
I'm still not entirely happy with this either. For example, see here. That error messages suggests only a member of
openshift-staff-engineers
can set the label, when in reality there are many users that can set it. Perhaps we should reword this as either-or ("you must be a member of these groups: xyz. Alternatively, consider assigning one of these members: abc"). Open to idea here.