Skip to content
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

require_self_approval: true should prevent suggesting PR author for approval #175

Open
BenTheElder opened this issue May 30, 2024 · 5 comments
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug. sig/testing Categorizes an issue or PR as relevant to SIG Testing.

Comments

@BenTheElder
Copy link
Member

[This is re-filed from https://github.com/kubernetes/test-infra/issues/29827]

What happened:

TLDR in a repo with implicit_self_approval off, prow will sometimes suggest the author as the approver, it should suggest someone else.

https://kubernetes.slack.com/archives/CDECRSC5U/p1669738130214399

What you expected to happen:

suggest non-pr-author for finding an approver

How to reproduce it (as minimally and precisely as possible):

.... you'll need implicit_self_approval disabled, yourself in OWNERS, and then file a PR until this happens.

Please provide links to example occurrences, if any:

lots of sample links in the slack thread linked above

Anything else we need to know?:

/sig testing

@k8s-ci-robot k8s-ci-robot added the sig/testing Categorizes an issue or PR as relevant to SIG Testing. label May 30, 2024
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Aug 28, 2024
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle rotten
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Sep 27, 2024
@petr-muller petr-muller added kind/bug Categorizes issue or PR as related to a bug. good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. and removed lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. labels Sep 30, 2024
@petr-muller
Copy link
Contributor

Approver logic is tricky but filtering out author name from the list of options does not seem too scary, so let's try marking it as a good first issue. I hope I'm not throwing someone under the bus 😬

@Bharadwajshivam28
Copy link

Bharadwajshivam28 commented Oct 3, 2024

Hey @BenTheElder @petr-muller can I look into this issue? also if yes then can you suggest me some steps to get started on this?

@petr-muller petr-muller changed the title implicit_self_approval: false should prevent suggesting PR author for approval require_self_approval: true should prevent suggesting PR author for approval Oct 8, 2024
@petr-muller petr-muller changed the title require_self_approval: true should prevent suggesting PR author for approval require_self_approval: true should prevent suggesting PR author for approval Oct 8, 2024
@petr-muller
Copy link
Contributor

@Bharadwajshivam28 Sure, feel free to give it a shot!

Here are some breadcrumbs. The problem is that Prow sometimes asks ...please ask for approval from AUTHOR... even when require_self_approval is set to true, indicating that authors with approval permissions do not get an automated approved label, and it is likely desirable for other approver to approve the PR (although the author can still approve it themselves, but if that behavior is desirable then the repo should disable require_self_approval.

The message seems to be built here from a Approvers struct (partially from its AssignedCCs member, partially from SuggestedCCs), you can follow its call chain to figure out how the Approver struct that ends us passed here is built and prevent the author from being added here if require_self_approval: true (unless they are the only approver, I guess).

**Once this PR has been reviewed and has the lgtm label**, please ask for approval from {{range $index, $cc := .ap.AssignedCCs}}{{if $index}}, {{end}}{{printf "[%s](https://github.com/%s)" $cc $cc}}{{end}} and additionally assign {{range $index, $cc := .ap.SuggestedCCs}}{{if $index}}, {{end}}{{printf "[%s](https://github.com/%s)" $cc $cc}}{{end}} for approval. For more information see [the Kubernetes Code Review Process]({{ .prProcessLink }}).
{{- else -}}
**Once this PR has been reviewed and has the lgtm label**, please assign {{range $index, $cc := .ap.SuggestedCCs}}{{if $index}}, {{end}}{{printf "[%s](https://github.com/%s)" $cc $cc}}{{end}} for approval. For more information see [the Kubernetes Code Review Process]({{ .prProcessLink }}).
{{- end}}
{{- else -}}
{{- if len .ap.AssignedCCs -}}
**Once this PR has been reviewed and has the lgtm label**, please ask for approval from {{range $index, $cc := .ap.AssignedCCs}}{{if $index}}, {{end}}{{printf "[%s](https://github.com/%s)" $cc $cc}}{{end}}. For more information see [the Kubernetes Code Review Process]({{ .prProcessLink }}).

I retitled this issue to mention the require_self_approval: true config instead, which is the current name of that config option. The original implicit_self_approve was renamed with inverted defaults to current require_self_approval in 2019.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug. sig/testing Categorizes an issue or PR as relevant to SIG Testing.
Projects
None yet
Development

No branches or pull requests

5 participants