Support disable-publisher and both-html-text content-type in email-ext

Support new options, disable-publisher option that is intended to
disable the publisher without removing the settings for testing,
and the both-html-text content-type option for the email-ext
plugin.

Change-Id: I6dab8101f8859a98be0c4a5f8068661c7af66a6b
This commit is contained in:
Somay Jain 2015-06-14 06:49:03 +05:30
parent 413c150815
commit ad76699f50
4 changed files with 17 additions and 5 deletions

View File

@ -1484,12 +1484,18 @@ def email_ext(parser, xml_parent, data):
Requires the Jenkins :jenkins-wiki:`Email-ext Plugin
<Email-ext+plugin>`.
:arg bool disable-publisher: Disable the publisher, while maintaining the
settings. The usage model for this is when you want to test things out
in the build, not send out e-mails during the testing. A message will
be printed to the build log saying that the publisher is disabled.
(default false)
:arg str recipients: Comma separated list of emails
:arg str reply-to: Comma separated list of emails that should be in
the Reply-To header for this project (default $DEFAULT_REPLYTO)
:arg str content-type: The content type of the emails sent. If not set, the
Jenkins plugin uses the value set on the main configuration page.
Possible values: 'html', 'text' or 'default' (default 'default')
Possible values: 'html', 'text', 'both-html-text' or 'default'
(default 'default')
:arg str subject: Subject for the email, can include variables like
${BUILD_NUMBER} or even groovy or javascript code
:arg str body: Content for the body of the email, can include variables
@ -1579,6 +1585,7 @@ def email_ext(parser, xml_parent, data):
'text': 'text/plain',
'html': 'text/html',
'default': 'default',
'both-html-text': 'both',
}
ctype = data.get('content-type', 'default')
if ctype not in content_type_mime:
@ -1594,10 +1601,12 @@ def email_ext(parser, xml_parent, data):
'attachments', '')
XML.SubElement(emailext, 'presendScript').text = data.get(
'presend-script', '')
XML.SubElement(emailext, 'attachBuildLog').text = \
str(data.get('attach-build-log', False)).lower()
XML.SubElement(emailext, 'saveOutput').text = \
str(data.get('save-output', False)).lower()
XML.SubElement(emailext, 'attachBuildLog').text = str(data.get(
'attach-build-log', False)).lower()
XML.SubElement(emailext, 'saveOutput').text = str(data.get(
'save-output', False)).lower()
XML.SubElement(emailext, 'disabled').text = str(data.get(
'disable-publisher', False)).lower()
XML.SubElement(emailext, 'replyTo').text = data.get('reply-to',
'$DEFAULT_REPLYTO')
matrix_dict = {'both': 'BOTH',

View File

@ -166,6 +166,7 @@
<presendScript>cancel=true</presendScript>
<attachBuildLog>false</attachBuildLog>
<saveOutput>true</saveOutput>
<disabled>false</disabled>
<replyTo>foo@example.com</replyTo>
<matrixTriggerMode>ONLY_CONFIGURATIONS</matrixTriggerMode>
</hudson.plugins.emailext.ExtendedEmailPublisher>

View File

@ -23,6 +23,7 @@
<presendScript/>
<attachBuildLog>false</attachBuildLog>
<saveOutput>false</saveOutput>
<disabled>false</disabled>
<replyTo>$DEFAULT_REPLYTO</replyTo>
<matrixTriggerMode>ONLY_CONFIGURATIONS</matrixTriggerMode>
</hudson.plugins.emailext.ExtendedEmailPublisher>

View File

@ -34,6 +34,7 @@
<presendScript/>
<attachBuildLog>false</attachBuildLog>
<saveOutput>false</saveOutput>
<disabled>false</disabled>
<replyTo>$DEFAULT_REPLYTO</replyTo>
</hudson.plugins.emailext.ExtendedEmailPublisher>
</publishers>