Add support for item.change for pipeline start-message formater
By adding that attribute in the formater it is then possible to report the buildset status URL as reporter start message. For instance: start-message: Build started. Ephemeral buildset status {status_url} /{pipeline.tenant.name}/status/change/{change.number}, {change.patchset}. Change-Id: I5f7503e4babc6b84b20292f2063ffd90cb6065d9
This commit is contained in:
parent
6f550eea59
commit
a9f7714502
|
@ -1,7 +1,7 @@
|
|||
- pipeline:
|
||||
name: gate
|
||||
manager: dependent
|
||||
start-message: Jobs started for {pipeline.name}.
|
||||
start-message: Jobs started in {pipeline.name} for {change.number},{change.patchset}.
|
||||
trigger:
|
||||
gerrit:
|
||||
- event: comment-added
|
||||
|
|
|
@ -4827,10 +4827,7 @@ For CI problems and help debugging, contact ci@example.org"""
|
|||
self.waitUntilSettled()
|
||||
|
||||
self.assertEqual(1, len(self.smtp_messages))
|
||||
|
||||
start_msg = """\
|
||||
Jobs started for gate."""
|
||||
|
||||
start_msg = "Jobs started in gate for 1,1."
|
||||
self.assertTrue(self.smtp_messages[0]['body'].startswith(start_msg))
|
||||
|
||||
@simple_layout('layouts/unmanaged-project.yaml')
|
||||
|
|
|
@ -128,8 +128,13 @@ class BaseReporter(object, metaclass=abc.ABCMeta):
|
|||
def _formatItemReportStart(self, item, with_jobs=True):
|
||||
status_url = get_default(self.connection.sched.config,
|
||||
'web', 'status_url', '')
|
||||
return item.pipeline.start_message.format(pipeline=item.pipeline,
|
||||
status_url=status_url)
|
||||
if status_url:
|
||||
status_url = item.formatUrlPattern(status_url)
|
||||
|
||||
return item.pipeline.start_message.format(
|
||||
pipeline=item.pipeline.getSafeAttributes(),
|
||||
change=item.change.getSafeAttributes(),
|
||||
status_url=status_url)
|
||||
|
||||
def _formatItemReportSuccess(self, item, with_jobs=True):
|
||||
msg = item.pipeline.success_message
|
||||
|
|
Loading…
Reference in New Issue