diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2023-09-01 12:11:42 +0200 |
|---|---|---|
| committer | Aleksandr Nogikh <nogikh@google.com> | 2023-09-06 10:29:02 +0000 |
| commit | 8c6013de89e4280c27344f6180db06ae27b7749f (patch) | |
| tree | 237fca72b2999e8b8917bbbeb4de8c3c8f76703e /dashboard/app/reporting_email.go | |
| parent | 736a3c37c74cb6da919ca7d68f3c1e2a2d2b62a7 (diff) | |
dashboard: auto-guess kernel and repo for #syz test
We used to support this only for external reportings, but let's
auto-guess these parameters for all incoming patch testing commands.
Diffstat (limited to 'dashboard/app/reporting_email.go')
| -rw-r--r-- | dashboard/app/reporting_email.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/dashboard/app/reporting_email.go b/dashboard/app/reporting_email.go index cb8b95e4e..17c8efcec 100644 --- a/dashboard/app/reporting_email.go +++ b/dashboard/app/reporting_email.go @@ -700,9 +700,13 @@ var emailCmdToStatus = map[email.Command]dashapi.BugStatus{ func handleTestCommand(c context.Context, info *bugInfoResult, msg *email.Email, command *email.SingleCommand) string { - args := strings.Split(command.Args, " ") - if len(args) != 2 { - return fmt.Sprintf("want 2 args (repo, branch), got %v", len(args)) + args := strings.Fields(command.Args) + if len(args) != 0 && len(args) != 2 { + return fmt.Sprintf("want either no args or 2 args (repo, branch), got %v", len(args)) + } + repo, branch := "", "" + if len(args) == 2 { + repo, branch = args[0], args[1] } if info.bug.sanitizeAccess(AccessPublic) != AccessPublic { log.Warningf(c, "%v: bug is not AccessPublic, patch testing request is denied", info.bug.Title) @@ -712,7 +716,7 @@ func handleTestCommand(c context.Context, info *bugInfoResult, err := handleTestRequest(c, &testReqArgs{ bug: info.bug, bugKey: info.bugKey, bugReporting: info.bugReporting, user: msg.Author, extID: msg.MessageID, link: msg.Link, - patch: []byte(msg.Patch), repo: args[0], branch: args[1], jobCC: msg.Cc}) + patch: []byte(msg.Patch), repo: repo, branch: branch, jobCC: msg.Cc}) if err != nil { var testDenied *TestRequestDeniedError var badTest *BadTestRequestError |
