Make report message introduction configurable.

By setting parameters on a pipeline, you can change the default
"Build successful/failed" introductory messages left on Gerrit.

Change-Id: Ie05c8c87a47994faced4ee67fda4ab4e64ea0d20
Reviewed-on: https://review.openstack.org/19677
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Reviewed-by: Jeremy Stanley <fungi@yuggoth.org>
Approved: James E. Blair <corvus@inaugust.com>
Tested-by: Jenkins
This commit is contained in:
James E. Blair 2013-01-14 15:47:28 -08:00 committed by Jenkins
parent 4795838dd2
commit 5637019738
6 changed files with 23 additions and 2 deletions

View File

@ -170,6 +170,16 @@ explanation of each of the parameters::
This is an optional field that may be used to provide a textual
description of the pipeline.
**success-message**
An optional field that supplies the introductory text in message
reported back to Gerrit when all the voting builds are successful.
Defaults to "Build successful."
**failure-message**
An optional field that supplies the introductory text in message
reported back to Gerrit when at least one voting build fails.
Defaults to "Build failed."
**manager**
There are currently two schemes for managing pipelines:

View File

@ -16,6 +16,7 @@ pipelines:
- name: gate
manager: DependentPipelineManager
failure-message: Build failed. For information on how to proceed, see http://wiki.example.org/Test_Failures
trigger:
- event: comment-added
approval:

View File

@ -19,6 +19,8 @@ pipelines:
- name: gate
manager: DependentPipelineManager
success-message: Your change is awesome.
failure-message: Build failed. For information on how to proceed, see http://wiki.example.org/Test_Failures
trigger:
- event: comment-added
approval:

View File

@ -45,6 +45,8 @@ class LayoutSchema(object):
pipeline = {v.required('name'): str,
v.required('manager'): manager,
'description': str,
'success-message': str,
'failure-message': str,
'trigger': toList(trigger),
'success': variable_dict,
'failure': variable_dict,

View File

@ -28,6 +28,8 @@ class Pipeline(object):
def __init__(self, name):
self.name = name
self.description = None
self.failure_message = None
self.success_message = None
self.job_trees = {} # project -> JobTree
self.manager = None
self.queues = []

View File

@ -96,6 +96,10 @@ class Scheduler(threading.Thread):
for conf_pipeline in data.get('pipelines', []):
pipeline = Pipeline(conf_pipeline['name'])
pipeline.description = conf_pipeline.get('description')
pipeline.failure_message = conf_pipeline.get('failure-message',
"Build failed.")
pipeline.success_message = conf_pipeline.get('success-message',
"Build succeeded.")
manager = globals()[conf_pipeline['manager']](self, pipeline)
pipeline.setManager(manager)
@ -759,9 +763,9 @@ class BasePipelineManager(object):
def formatReport(self, changeish):
ret = ''
if self.pipeline.didAllJobsSucceed(changeish):
ret += 'Build successful\n\n'
ret += self.pipeline.success_message + '\n\n'
else:
ret += 'Build failed\n\n'
ret += self.pipeline.failure_message + '\n\n'
if changeish.dequeued_needing_change:
ret += "This change depends on a change that failed to merge."