-
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
Port docs-no-retest from munge to prow #4895
Port docs-no-retest from munge to prow #4895
Conversation
Hi @paradigm. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with I understand the commands that are listed here. 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. I understand the commands that are listed here. |
Awesome! |
) | ||
|
||
var ( | ||
docFilesRegex = regexp.MustCompile("^.*\\.(md|png|svg|dia)$") |
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.
Using back ticks instead of quotes for regexps will avoid the need to double escape. `^.*\.(md|png|svg|dia)$`
GetPullRequestChanges(org, repo string, number int) ([]github.PullRequestChange, error) | ||
} | ||
|
||
func handlePR(gc githubClient, pe github.PullRequestEvent) error { |
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 function should start by checking that the event's Action
is opened, reopened, or synchronized, and return early if not.
|
||
if docsOnly && !hasTargetLabel { | ||
if err := gc.AddLabel(owner, repo, num, labelSkipRetest); err != nil { | ||
return fmt.Errorf("error adding label to %s/%s PR #%d: %v", owner, repo, num, 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 convention Prow uses for referencing github issues is fmt.Sprintf("%s/%s#%d", owner, repo, num)
Filename: "/path/to/file/foo.go", | ||
}, | ||
}, | ||
getIssueLabelsErr: testError, |
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.
s/getIssueLabelsErr/getPullRequestChangesErr/
|
||
type ghc struct { | ||
*testing.T | ||
labels map[github.Label]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.
Just store the label name instead of the entire Label
struct since the Color
and ID
fields are ignored.
4af474f
to
ba38c7d
Compare
All those changes made sense to me, applied here. |
num = pe.PullRequest.Number | ||
) | ||
|
||
switch pe.Action { |
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.
Generally more idiomatic golang
to do this with an if
statement like here
c.T.Logf("RemoveLabel: %s", targetLabel) | ||
for label := range c.labels { | ||
if label == targetLabel { | ||
delete(c.labels, 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.
You're doing a deletion here so you don't really need the bool
, can just use map[string]interface{}
(the k8s set.String
utility)
ba38c7d
to
ee12b73
Compare
The configs need to be updated as well. This will also require a hook bump. Please run |
ee12b73
to
bfbe1f9
Compare
Looks like you need to rebase before running |
bfbe1f9
to
dd2fb44
Compare
https://github.com/kubernetes/test-infra/blob/master/prow/hook/plugins.go needs to be updated. |
dd2fb44
to
87a33a9
Compare
err := handlePR(client, event) | ||
|
||
if err != nil && c.err == nil { | ||
t.Errorf("test case \"%s\": unexpected handlePR error: %v", c.name, 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.
nit: you can use %q instead of "%s"
/lgtm |
@@ -51,6 +51,7 @@ plugins: | |||
kubernetes/kubernetes: | |||
- trigger | |||
- release-note | |||
- docs-no-retest |
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.
@cjwagner I am sure you already know that this will require you to redeploy instantly.
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.
Yep, I'll merge and redeploy Prow and the kubernetes misc-mungers deployment now.
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cjwagner, kargakis, paradigm The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
@paradigm: I updated Prow plugins config for you! 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. |
From what I understand, there is an effort to move from munge to prow for github integration. This ports munge's docs-no-retest functionality to prow. It also adds test coverage, as munge's docs-no-retest was not tested.
/cc @Kargakis @stevekuznetsov
/assign @Kargakis