about summary refs log tree commit diff
path: root/third_party/gerrit-queue/submitqueue/runner.go
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2021-12-10T08·33+0300
committerclbot <clbot@tvl.fyi>2021-12-10T13·09+0000
commit6e4decf19b2b221030df0e3614c579ff3896b25a (patch)
tree4e4eafaa6acda9d5b4360ca5d5fb8f9243dfd69c /third_party/gerrit-queue/submitqueue/runner.go
parent811e6d7d9fbd0bfd14b23d98dba95c4b2121b2c8 (diff)
refactor(gerrit-queue): Gracefully handle missing changesets r/3181
(Patch contributed by an anonymous contributor)

Change-Id: I29fd7dd008d4e509ea074a38d3948946b26da7ab
Diffstat (limited to 'third_party/gerrit-queue/submitqueue/runner.go')
-rw-r--r--third_party/gerrit-queue/submitqueue/runner.go12
1 files changed, 10 insertions, 2 deletions
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
 			}
 		}