-
Notifications
You must be signed in to change notification settings - Fork 2.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
Migrate label-unapproved-picks from mungegithub to prow #9128
Migrate label-unapproved-picks from mungegithub to prow #9128
Conversation
/cc @cblecker @guineveresaenger |
ec47bb2
to
74bae8c
Compare
I get the utility, but I also really don't want any more mungegithub maintenance. Can we instead port this to a prow plugin? |
@spiffxp would this mean porting all the cherrypick-related components here: https://github.com/kubernetes/test-infra/tree/master/mungegithub/mungers? |
overhauling cherrypicking is a much larger task, not trying to blow your scope (and I want to discuss this with patch managers) I think I'm just asking to port this munger EDIT: yes, I am, |
@spiffxp 👍 I'll take a dab at porting it to prow tomorrow (it's 1am here 🙃) |
Really appreciate it. If it turns out to be too much of a pain, and this is really necessary to move us forward, we can look at merging. But I think this is the (or very nearly the) last piece of mungegithub to be ported over. And the bonfire will be glorious. |
74bae8c
to
4476950
Compare
@spiffxp Done! This original munger did not contain any tests. This PR adds tests too. PS: I got confused by your edit 🙈 and ported only the |
4476950
to
7ba56e0
Compare
obj.WriteComment(labelUnapprovedBody) | ||
} | ||
|
||
func (LabelUnapprovedPicks) isStaleIssueComment(obj *github.MungeObject, comment *githubapi.IssueComment) bool { |
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.
I'm not sure what this does? I didn't add anything related to this to the plugin for now.
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.
This was the old comment cleanup mechanism
// Package cherrypick adds the `do-not-merge/cherry-pick-not-approved` | ||
// label to PRs against a release branch which do not have the | ||
// `cherrypick-approved` label. | ||
package cherrypick |
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.
Should the name be cherrypick-unapproved
or something like that? (ditto for pluginName
)
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.
We an external cherrypicker
plugin that implements a /cherrypick
command so yeah, this package/plugin should be named something else to avoid confusion.
Not sure what off the top of my head though. Will review and come back
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.
cherrypick-unapproved
sounds reasonable as a plugin name. Package names can't have hyphens though so the package would be cherrypickunapproved
.
|
||
func handlePR(gc githubClient, log *logrus.Entry, pr *github.PullRequestEvent) error { | ||
// Only consider the events that indicate opening of the PR | ||
if pr.Action != github.PullRequestActionOpened && pr.Action != github.PullRequestActionReopened { |
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.
PTAL if this right.
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.
This also needs to handle events where pr.Action
is the label or unlabel action and pr.Label
is the cherrypick-approved
label.
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.
Just a couple nits.
/lgtm
/hold
} | ||
|
||
// shouldPrune finds comments left by this plugin. | ||
func shouldPrune(log *logrus.Entry, commentBody string) func(github.IssueComment) bool { |
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.
log
is not used.
You could just get rid of this entire function now and pass this value to PruneComments instead:
func(comment github.IssueComment) bool {
return strings.Contains(comment.Body, comment)
}
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.
Done.
labels, err := gc.GetIssueLabels(org, repo, pr.Number) | ||
if err != nil { | ||
log.WithError(err).Errorf("failed to list labels") | ||
return err |
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 returned error will be logged so the log message here is redundant.
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.
Done.
79afa70
to
030e08a
Compare
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.
Thanks again for migrating this!
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cjwagner, nikhita The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/hold cancel |
@nikhita: Updated the
In response to this:
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/test-infra repository. |
Cherry-picks are not getting merged right now because the cherry-pick labels were updated from However, prow was not bumped. The current prow code looks for a Also, even after prow is bumped, all such PRs (https://github.com/kubernetes/kubernetes/labels/cherry-pick-approved) will need a trigger in terms of changing the cherrypick labels or closing/reopening the PR. I'll take care of closing+reopening all the affected ones. 👍 Can some someone bump prow to get this fixed? |
(But of course a bump to Prow is also necessary, contact the on-call for that.) |
@stevekuznetsov The change to
Have reached out on Slack about this. 👍 |
This PR migrates the
label-unapproved-picks
munger from mungegithub to prow. Ref: #3331.The original munger did not contain any tests. This PR also adds tests for it.
This PR also makes the plugin configurable:
do-not-merge/cherry-pick-not-approved
label can be specified.This PR also updates the label name from
cherrypick-unapproved
tocherry-pick-unapproved
.The content below this line was originally what the PR was based on. This PR contains the following change as well i.e. it updates the comment body to list the patch release managers.
Ref: kubernetes/community#994 (comment). Note: this does not assign the patch release manager, just suggests them so that it's not too noisy for the release manager. Sometimes it's also useful to assign the release manager only after the cherrypick PR has received lgtm + approval.
Part of #1795
If a cherrypick PR does not have the
cherrypick-approved
label, the comment (by the bot) just lists that this label does not exist on the PR and adds ado-not-merge/cherry-pick-not-approved
label. It does not tell us what needs to be done for cherrypick approval. See kubernetes/kubernetes#67616 (comment) for an example.This PR updates the comment to point to the list of patch release managers so the author of the PR can know whom to assign to get the cherrypick approved.
/sig release
/sig contributor-experience