google / triage-party

🎉 Triage Party: massively multi-player GitHub triage 🎉
Apache License 2.0
504 stars 80 forks source link

Validate configured repos #234

Closed kalafut closed 3 years ago

kalafut commented 3 years ago

Currently if a repo name cannot be parsed or has no provider, a panic will result, e.g.:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x178990f]

goroutine 40 [running]:
github.com/google/triage-party/pkg/hubbub.(*Engine).updateIssues(0xc000440b40, 0x1b12ec0, 0xc00003c098, 0x7ffeefbff707, 0x1, 0x7ffeefbff709, 0x1, 0x7ffeefbff6ff, 0x7, 0x0, ...)
    /Users/kalafut/dev/triage-party/pkg/hubbub/issue.go:87 +0x4ef
github.com/google/triage-party/pkg/hubbub.(*Engine).cachedIssues(0xc000440b40, 0x1b12ec0, 0xc00003c098, 0x7ffeefbff707, 0x1, 0x7ffeefbff709, 0x1, 0x7ffeefbff6ff, 0x7, 0x0, ...)
    /Users/kalafut/dev/triage-party/pkg/hubbub/issue.go:46 +0x378
github.com/google/triage-party/pkg/hubbub.(*Engine).SearchIssues.func1(0xc000592580, 0xc0000c8d80, 0xc000440b40, 0x1b12ec0, 0xc00003c098, 0xc000693440, 0xc000693400)
    /Users/kalafut/dev/triage-party/pkg/hubbub/search.go:66 +0x178
created by github.com/google/triage-party/pkg/hubbub.(*Engine).SearchIssues
    /Users/kalafut/dev/triage-party/pkg/hubbub/search.go:58 +0x438

This PR validates all URLs as soon as the config is loaded and will return a nicer error:

F1113 15:04:03.690167   53505 main.go:129] load from config.yaml: validate config: unknown provider host "abc.com"