Add option to report elapsed build times.

The new format will be:
  "http://logs.example.com/6/1/gate/project2-merge/2 : SUCCESS in 00:00:00"

And the option is enabled by default.

Change-Id: Ib50c4948ea0a7b552d46a0e72ecb6c1a9609a771
Reviewed-on: https://review.openstack.org/27570
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Reviewed-by: Jeremy Stanley <fungi@yuggoth.org>
Approved: Jeremy Stanley <fungi@yuggoth.org>
Tested-by: Jenkins
This commit is contained in:
James E. Blair 2013-04-26 09:04:23 -07:00 committed by Jenkins
parent e4035796a6
commit 0ac6c01692
2 changed files with 18 additions and 1 deletions

View File

@ -100,6 +100,11 @@ zuul
git_dir.
``push_change_refs=true``
**report_times**
Boolean value (``true`` or ``false``) that determines if Zuul should
include elapsed times for each job in the textual report.
``report_times=true``
**status_url**
URL that will be posted in Zuul comments made to Gerrit changes when
beginning Jenkins jobs for a change.

View File

@ -508,6 +508,11 @@ class BasePipelineManager(object):
self.success_action = {}
self.failure_action = {}
self.start_action = {}
if self.sched.config.has_option('zuul', 'report_times'):
self.report_times = self.sched.config.getboolean(
'zuul', 'report_times')
else:
self.report_times = True
def __str__(self):
return "<%s %s>" % (self.__class__.__name__, self.pipeline.name)
@ -884,7 +889,14 @@ class BasePipelineManager(object):
voting = ' (non-voting)'
else:
voting = ''
ret += '- %s : %s%s\n' % (url, result, voting)
if self.report_times and build.end_time and build.start_time:
dt = int(build.end_time - build.start_time)
m, s = divmod(dt, 60)
h, m = divmod(m, 60)
elapsed = ' in %02d:%02d:%02d' % (h, m, s)
else:
elapsed = ''
ret += '- %s : %s%s%s\n' % (url, result, elapsed, voting)
return ret
def formatDescription(self, build):