Fixing defaults for email-ext
If you go into Jenkins and just fill out the reipient list and click save, Jenkins will default to having a Failure Trigger. Jenkins will also set the subject to $DEFAULT_SUBJECT and the content to $DEFAULT_CONTENT. This change is making JJB have the same defaults for the email-ext functionality. This way a user can just set the recipient list and have it show up in Jenkins. Previously just setting the reipient list lead to $DEFAULT_RECIPIENTS being set instead with a FailureTrigger and this can be confusing to some users. This change also makes the recipient list default to $DEFAULT_RECIPIENTS, like the plugin does when you first add it to a job. This way a user can just specify email-ext and the global defaults will be used. Change-Id: I8f207d495466a4a87431dbcb2cd46cb661b60ce1 Reviewed-on: https://review.openstack.org/19391 Reviewed-by: Clark Boylan <clark.boylan@gmail.com> Approved: James E. Blair <corvus@inaugust.com> Reviewed-by: James E. Blair <corvus@inaugust.com> Tested-by: Jenkins
This commit is contained in:
parent
059a6b52fc
commit
fb582ad2dc
@ -681,7 +681,7 @@ def email_ext(parser, xml_parent, data):
|
||||
:arg bool aborted: Send an email if the build is aborted (default false)
|
||||
:arg bool regression: Send an email if there is a regression
|
||||
(default false)
|
||||
:arg bool failure: Send an email if the build fails (default false)
|
||||
:arg bool failure: Send an email if the build fails (default true)
|
||||
:arg bool improvement: Send an email if the build improves (default false)
|
||||
:arg bool still-failing: Send an email if the build is still failing
|
||||
(default false)
|
||||
@ -713,7 +713,10 @@ def email_ext(parser, xml_parent, data):
|
||||
"""
|
||||
emailext = XML.SubElement(xml_parent,
|
||||
'hudson.plugins.emailext.ExtendedEmailPublisher')
|
||||
XML.SubElement(emailext, 'recipientList').text = data['recipients']
|
||||
if 'recipients' in data:
|
||||
XML.SubElement(emailext, 'recipientList').text = data['recipients']
|
||||
else:
|
||||
XML.SubElement(emailext, 'recipientList').text = '$DEFAULT_RECIPIENTS'
|
||||
ctrigger = XML.SubElement(emailext, 'configuredTriggers')
|
||||
if data.get('unstable', False):
|
||||
base_email_ext(parser, ctrigger, data, 'UnstableTrigger')
|
||||
@ -725,7 +728,7 @@ def email_ext(parser, xml_parent, data):
|
||||
base_email_ext(parser, ctrigger, data, 'AbortedTrigger')
|
||||
if data.get('regression', False):
|
||||
base_email_ext(parser, ctrigger, data, 'RegressionTrigger')
|
||||
if data.get('failure', False):
|
||||
if data.get('failure', True):
|
||||
base_email_ext(parser, ctrigger, data, 'FailureTrigger')
|
||||
if data.get('improvement', False):
|
||||
base_email_ext(parser, ctrigger, data, 'ImprovementTrigger')
|
||||
@ -740,8 +743,10 @@ def email_ext(parser, xml_parent, data):
|
||||
if data.get('pre-build', False):
|
||||
base_email_ext(parser, ctrigger, data, 'PreBuildTrigger')
|
||||
XML.SubElement(emailext, 'contentType').text = 'default'
|
||||
XML.SubElement(emailext, 'defaultSubject').text = data.get('subject', '')
|
||||
XML.SubElement(emailext, 'defaultContent').text = data.get('body', '')
|
||||
XML.SubElement(emailext, 'defaultSubject').text = data.get(
|
||||
'subject', '$DEFAULT_SUBJECT')
|
||||
XML.SubElement(emailext, 'defaultContent').text = data.get(
|
||||
'body', '$DEFAULT_CONTENT')
|
||||
XML.SubElement(emailext, 'attachmentsPattern').text = ''
|
||||
XML.SubElement(emailext, 'presendScript').text = ''
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user