From 8dfcccab9d0ad84a9eea46ad529d58e5d6abf0cf Mon Sep 17 00:00:00 2001 From: Daniel Hiller Date: Tue, 17 Sep 2024 14:59:44 +0200 Subject: [PATCH 1/2] approvers: add commenter that marks stale PRs Adds a periodic job using the commenter to mark PRs that haven't received a review by an approver within a week with the needs/approver-review label. Since that label doesn't exist yet, it is added as well - furthermore the documentation page is updated. Signed-off-by: Daniel Hiller --- docs/labels.md | 1 + .../project-infra-periodics.yaml | 35 +++++++++++++++++++ .../base/configs/current/labels/labels.yaml | 6 ++++ 3 files changed, 42 insertions(+) diff --git a/docs/labels.md b/docs/labels.md index d1a43821b3..8a66cb9cfb 100644 --- a/docs/labels.md +++ b/docs/labels.md @@ -111,6 +111,7 @@ larger set of contributors to apply/remove them. | `lgtm` | Indicates that a PR is ready to be merged.| reviewers or members | [lgtm](https://prow.ci.kubevirt.io/command-help#lgtm) | | `needs-ok-to-test` | Indicates a PR that requires an org member to verify it is safe to test.| prow | [trigger](https://prow.ci.kubevirt.io/command-help#trigger) | | `needs-rebase` | Indicates a PR cannot be merged because it has merge conflicts with HEAD.| prow | [needs-rebase](https://prow.ci.kubevirt.io/command-help#needs-rebase) | +| `needs/approver-review` | Indicates that a PR requires a review from an approver.| prow | [label](https://prow.ci.kubevirt.io/command-help#label) | | `ok-to-test` | Indicates a non-member PR verified by an org member that is safe to test.| prow | [trigger](https://prow.ci.kubevirt.io/command-help#trigger) | | `release-note` | Denotes a PR that will be considered when it comes time to generate release notes.| prow | [release-note](https://prow.ci.kubevirt.io/command-help#release-note) | | `release-note-action-required` | Denotes a PR that introduces potentially breaking changes that require user action.| prow | [releasenote](https://prow.ci.kubevirt.io/command-help#releasenote) | diff --git a/github/ci/prow-deploy/files/jobs/kubevirt/project-infra/project-infra-periodics.yaml b/github/ci/prow-deploy/files/jobs/kubevirt/project-infra/project-infra-periodics.yaml index 8869cdd9a0..b6b51ef0a7 100644 --- a/github/ci/prow-deploy/files/jobs/kubevirt/project-infra/project-infra-periodics.yaml +++ b/github/ci/prow-deploy/files/jobs/kubevirt/project-infra/project-infra-periodics.yaml @@ -163,6 +163,41 @@ periodics: - --template - --ceiling=10 - --confirm +- name: periodic-project-infra-needs-approver-review + interval: 1h + annotations: + testgrid-create-test-group: "false" + labels: + preset-github-credentials: "true" + decorate: true + cluster: kubevirt-prow-control-plane + spec: + containers: + - image: gcr.io/k8s-staging-test-infra/commenter:v20240801-a5d9345e59 + command: + - /ko-app/commenter + args: + - |- + --query=org:kubevirt + is:open + is:pr + label:lgtm + -label:approved + -label:do-not-merge/work-in-progress + -label:needs/approver-review + is:public + - --updated=168h + - --token=/etc/github/oauth + - |- + --comment=Pull requests that are marked with `lgtm` should receive a review + from an approver within 1 week. + + After that period they are marked with the label `needs/approver-review`. + + /needs approver-review + - --template + - --ceiling=10 + - --confirm - name: periodic-project-infra-autoowners interval: 24h annotations: diff --git a/github/ci/prow-deploy/kustom/base/configs/current/labels/labels.yaml b/github/ci/prow-deploy/kustom/base/configs/current/labels/labels.yaml index 059824c7bc..535a5be1b3 100644 --- a/github/ci/prow-deploy/kustom/base/configs/current/labels/labels.yaml +++ b/github/ci/prow-deploy/kustom/base/configs/current/labels/labels.yaml @@ -319,6 +319,12 @@ default: target: prs prowPlugin: lgtm addedBy: reviewers or members + - color: b60205 + description: Indicates that a PR requires a review from an approver. + name: needs/approver-review + target: prs + prowPlugin: label + addedBy: prow - color: 0ffa16 description: Indicates a PR has been approved by an approver from all required OWNERS files. name: approved From d662df876c897d4dc852a0f56e61e2f87858ca78 Mon Sep 17 00:00:00 2001 From: Daniel Hiller Date: Tue, 17 Sep 2024 17:38:29 +0200 Subject: [PATCH 2/2] approvers: rename label from needs/approver-review Since the initial approach (using the `/needs ...`) is not supported by the label plugin, we use the `/label` command. This requires a configuration in the label plugin section to allow the bot user to set the label on PRs, which we add here. Finally we update the labels.md page with the latest changes. Signed-off-by: Daniel Hiller --- docs/labels.md | 2 +- .../jobs/kubevirt/project-infra/project-infra-periodics.yaml | 4 ++-- .../kustom/base/configs/current/labels/labels.yaml | 2 +- .../kustom/base/configs/current/plugins/plugins.yaml | 3 +++ 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/docs/labels.md b/docs/labels.md index 8a66cb9cfb..6eb2694cd1 100644 --- a/docs/labels.md +++ b/docs/labels.md @@ -109,9 +109,9 @@ larger set of contributors to apply/remove them. | `do-not-merge/release-note-label-needed` | Indicates that a PR should not merge because it's missing one of the release note labels.

This was previously `needs/release-note`, | prow | [release-note](https://prow.ci.kubevirt.io/command-help#release-note) | | `do-not-merge/work-in-progress` | Indicates that a PR should not merge because it is a work in progress.| prow | [wip](https://prow.ci.kubevirt.io/command-help#wip) | | `lgtm` | Indicates that a PR is ready to be merged.| reviewers or members | [lgtm](https://prow.ci.kubevirt.io/command-help#lgtm) | +| `needs-approver-review` | Indicates that a PR requires a review from an approver.| prow | [label](https://prow.ci.kubevirt.io/command-help#label) | | `needs-ok-to-test` | Indicates a PR that requires an org member to verify it is safe to test.| prow | [trigger](https://prow.ci.kubevirt.io/command-help#trigger) | | `needs-rebase` | Indicates a PR cannot be merged because it has merge conflicts with HEAD.| prow | [needs-rebase](https://prow.ci.kubevirt.io/command-help#needs-rebase) | -| `needs/approver-review` | Indicates that a PR requires a review from an approver.| prow | [label](https://prow.ci.kubevirt.io/command-help#label) | | `ok-to-test` | Indicates a non-member PR verified by an org member that is safe to test.| prow | [trigger](https://prow.ci.kubevirt.io/command-help#trigger) | | `release-note` | Denotes a PR that will be considered when it comes time to generate release notes.| prow | [release-note](https://prow.ci.kubevirt.io/command-help#release-note) | | `release-note-action-required` | Denotes a PR that introduces potentially breaking changes that require user action.| prow | [releasenote](https://prow.ci.kubevirt.io/command-help#releasenote) | diff --git a/github/ci/prow-deploy/files/jobs/kubevirt/project-infra/project-infra-periodics.yaml b/github/ci/prow-deploy/files/jobs/kubevirt/project-infra/project-infra-periodics.yaml index b6b51ef0a7..e473afb105 100644 --- a/github/ci/prow-deploy/files/jobs/kubevirt/project-infra/project-infra-periodics.yaml +++ b/github/ci/prow-deploy/files/jobs/kubevirt/project-infra/project-infra-periodics.yaml @@ -192,9 +192,9 @@ periodics: --comment=Pull requests that are marked with `lgtm` should receive a review from an approver within 1 week. - After that period they are marked with the label `needs/approver-review`. + After that period the bot marks them with the label `needs-approver-review`. - /needs approver-review + /label needs-approver-review - --template - --ceiling=10 - --confirm diff --git a/github/ci/prow-deploy/kustom/base/configs/current/labels/labels.yaml b/github/ci/prow-deploy/kustom/base/configs/current/labels/labels.yaml index 535a5be1b3..49859456da 100644 --- a/github/ci/prow-deploy/kustom/base/configs/current/labels/labels.yaml +++ b/github/ci/prow-deploy/kustom/base/configs/current/labels/labels.yaml @@ -321,7 +321,7 @@ default: addedBy: reviewers or members - color: b60205 description: Indicates that a PR requires a review from an approver. - name: needs/approver-review + name: needs-approver-review target: prs prowPlugin: label addedBy: prow diff --git a/github/ci/prow-deploy/kustom/base/configs/current/plugins/plugins.yaml b/github/ci/prow-deploy/kustom/base/configs/current/plugins/plugins.yaml index ee998e372c..d1db477319 100644 --- a/github/ci/prow-deploy/kustom/base/configs/current/plugins/plugins.yaml +++ b/github/ci/prow-deploy/kustom/base/configs/current/plugins/plugins.yaml @@ -741,6 +741,9 @@ override: label: restricted_labels: 'kubevirt': + - allowed_users: + - kubevirt-bot + label: needs-approver-review - allowed_teams: - kubevirtorg-label label: good-first-issue