builds: set missing start/end time for node errors

When a build failed with NODE_FAILURE, the reported result doesn't have a
start/end time.

Change-Id: I3323347e6c91932690dac998c68eaf4a0fea2e5f
This commit is contained in:
Tristan Cacqueray 2017-05-22 13:25:07 +00:00
parent be64ed2777
commit 3727ef7b9c
2 changed files with 6 additions and 0 deletions

View File

@ -14,6 +14,7 @@
import datetime
import logging
import time
import voluptuous as v
from zuul.reporter import BaseReporter
@ -65,6 +66,9 @@ class SQLReporter(BaseReporter):
# stats about builds. It doesn't understand how to store
# information about the change.
continue
# Ensure end_time is defined
if not build.end_time:
build.end_time = time.time()
(result, url) = item.formatJobResult(job)

View File

@ -2219,6 +2219,8 @@ class QueueItem(object):
def setNodeRequestFailure(self, job):
fakebuild = Build(job, None)
fakebuild.start_time = time.time()
fakebuild.end_time = time.time()
self.addBuild(fakebuild)
fakebuild.result = 'NODE_FAILURE'
self.setResult(fakebuild)