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:
parent
4795838dd2
commit
5637019738
|
@ -170,6 +170,16 @@ explanation of each of the parameters::
|
||||||
This is an optional field that may be used to provide a textual
|
This is an optional field that may be used to provide a textual
|
||||||
description of the pipeline.
|
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**
|
**manager**
|
||||||
There are currently two schemes for managing pipelines:
|
There are currently two schemes for managing pipelines:
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ pipelines:
|
||||||
|
|
||||||
- name: gate
|
- name: gate
|
||||||
manager: DependentPipelineManager
|
manager: DependentPipelineManager
|
||||||
|
failure-message: Build failed. For information on how to proceed, see http://wiki.example.org/Test_Failures
|
||||||
trigger:
|
trigger:
|
||||||
- event: comment-added
|
- event: comment-added
|
||||||
approval:
|
approval:
|
||||||
|
|
|
@ -19,6 +19,8 @@ pipelines:
|
||||||
|
|
||||||
- name: gate
|
- name: gate
|
||||||
manager: DependentPipelineManager
|
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:
|
trigger:
|
||||||
- event: comment-added
|
- event: comment-added
|
||||||
approval:
|
approval:
|
||||||
|
|
|
@ -45,6 +45,8 @@ class LayoutSchema(object):
|
||||||
pipeline = {v.required('name'): str,
|
pipeline = {v.required('name'): str,
|
||||||
v.required('manager'): manager,
|
v.required('manager'): manager,
|
||||||
'description': str,
|
'description': str,
|
||||||
|
'success-message': str,
|
||||||
|
'failure-message': str,
|
||||||
'trigger': toList(trigger),
|
'trigger': toList(trigger),
|
||||||
'success': variable_dict,
|
'success': variable_dict,
|
||||||
'failure': variable_dict,
|
'failure': variable_dict,
|
||||||
|
|
|
@ -28,6 +28,8 @@ class Pipeline(object):
|
||||||
def __init__(self, name):
|
def __init__(self, name):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.description = None
|
self.description = None
|
||||||
|
self.failure_message = None
|
||||||
|
self.success_message = None
|
||||||
self.job_trees = {} # project -> JobTree
|
self.job_trees = {} # project -> JobTree
|
||||||
self.manager = None
|
self.manager = None
|
||||||
self.queues = []
|
self.queues = []
|
||||||
|
|
|
@ -96,6 +96,10 @@ class Scheduler(threading.Thread):
|
||||||
for conf_pipeline in data.get('pipelines', []):
|
for conf_pipeline in data.get('pipelines', []):
|
||||||
pipeline = Pipeline(conf_pipeline['name'])
|
pipeline = Pipeline(conf_pipeline['name'])
|
||||||
pipeline.description = conf_pipeline.get('description')
|
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)
|
manager = globals()[conf_pipeline['manager']](self, pipeline)
|
||||||
pipeline.setManager(manager)
|
pipeline.setManager(manager)
|
||||||
|
|
||||||
|
@ -759,9 +763,9 @@ class BasePipelineManager(object):
|
||||||
def formatReport(self, changeish):
|
def formatReport(self, changeish):
|
||||||
ret = ''
|
ret = ''
|
||||||
if self.pipeline.didAllJobsSucceed(changeish):
|
if self.pipeline.didAllJobsSucceed(changeish):
|
||||||
ret += 'Build successful\n\n'
|
ret += self.pipeline.success_message + '\n\n'
|
||||||
else:
|
else:
|
||||||
ret += 'Build failed\n\n'
|
ret += self.pipeline.failure_message + '\n\n'
|
||||||
|
|
||||||
if changeish.dequeued_needing_change:
|
if changeish.dequeued_needing_change:
|
||||||
ret += "This change depends on a change that failed to merge."
|
ret += "This change depends on a change that failed to merge."
|
||||||
|
|
Loading…
Reference in New Issue