From 6e4decf19b2b221030df0e3614c579ff3896b25a Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 10 Dec 2021 11:33:52 +0300 Subject: refactor(gerrit-queue): Gracefully handle missing changesets (Patch contributed by an anonymous contributor) Change-Id: I29fd7dd008d4e509ea074a38d3948946b26da7ab --- third_party/gerrit-queue/submitqueue/runner.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'third_party/gerrit-queue') diff --git a/third_party/gerrit-queue/submitqueue/runner.go b/third_party/gerrit-queue/submitqueue/runner.go index 6e4a54a71bb9..5ac4b04db0fd 100644 --- a/third_party/gerrit-queue/submitqueue/runner.go +++ b/third_party/gerrit-queue/submitqueue/runner.go @@ -128,6 +128,10 @@ func (r *Runner) Trigger(fetchOnly bool) error { // we now need to check CI feedback: // wipSerie might have failed CI in the meantime for _, c := range r.wipSerie.ChangeSets { + if c == nil { + l.Error("BUG: changeset is nil") + continue + } if c.Verified < 0 { l.WithField("failingChangeset", c).Warnf("wipSerie failed CI in the meantime, discarding.") r.wipSerie = nil @@ -137,6 +141,10 @@ func (r *Runner) Trigger(fetchOnly bool) error { // it might still be waiting for CI for _, c := range r.wipSerie.ChangeSets { + if c == nil { + l.Error("BUG: changeset is nil") + continue + } if c.Verified == 0 { l.WithField("pendingChangeset", c).Warnf("still waiting for CI feedback in wipSerie, going back to sleep.") // break the loop, take a look at it at the next trigger. @@ -158,8 +166,8 @@ func (r *Runner) Trigger(fetchOnly bool) error { } r.wipSerie = nil } else { - // should never be reached?! - log.Warnf("reached branch we should never reach") + l.Error("BUG: wipSerie is not autosubmittable") + r.wipSerie = nil } } -- cgit 1.4.1