Skip to content

Commit

Permalink
maintner/maintnerd/maintapi: handle non-existing Gerrit project grace…
Browse files Browse the repository at this point in the history
…fully

If a new Gerrit repository is created and has activity before
the x/build/repos package is updated, the Gerrit search query in
goFindTryWork may find CLs from the new repo and ask maintner about it.
It's expected that maintner won't know about it yet, so handle such
case by skipping those CLs.

Fixes golang/go#49286.

Change-Id: I5ab6e586baa909b371203f081c6ae7fbd44c15b3
Reviewed-on: https://go-review.googlesource.com/c/build/+/360734
Reviewed-by: Carlos Amedee <[email protected]>
Run-TryBot: Carlos Amedee <[email protected]>
TryBot-Result: Go Bot <[email protected]>
Trust: Dmitri Shuralyov <[email protected]>
  • Loading branch information
dmitshur committed Nov 2, 2021
1 parent fd71dbe commit 5891341
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion maintner/maintnerd/maintapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,12 @@ func goFindTryWork(ctx context.Context, gerritc *gerrit.Client, maintc *maintner

res := new(apipb.GoFindTryWorkResponse)
for _, ci := range cis {
cl := maintc.Gerrit().Project("go.googlesource.com", ci.Project).CL(int32(ci.ChangeNumber))
proj := maintc.Gerrit().Project("go.googlesource.com", ci.Project)
if proj == nil {
log.Printf("nil Gerrit project %q", ci.Project)
continue
}
cl := proj.CL(int32(ci.ChangeNumber))
if cl == nil {
log.Printf("nil Gerrit CL %v", ci.ChangeNumber)
continue
Expand Down

0 comments on commit 5891341

Please sign in to comment.