Merge "Add attachment pattern expression to email-ext."

This commit is contained in:
Jenkins 2014-03-03 19:01:14 +00:00 committed by Gerrit Code Review
commit e53ac245ad
3 changed files with 5 additions and 2 deletions

View File

@ -1388,6 +1388,7 @@ def email_ext(parser, xml_parent, data):
like ${BUILD_NUMBER}, but the real magic is using groovy or like ${BUILD_NUMBER}, but the real magic is using groovy or
javascript to hook into the Jenkins API itself javascript to hook into the Jenkins API itself
:arg bool attach-build-log: Include build log in the email (default false) :arg bool attach-build-log: Include build log in the email (default false)
:arg str attachments: pattern of files to include as attachment (optional)
:arg bool unstable: Send an email for an unstable result (default false) :arg bool unstable: Send an email for an unstable result (default false)
:arg bool first-failure: Send an email for just the first failure :arg bool first-failure: Send an email for just the first failure
(default false) (default false)
@ -1451,7 +1452,8 @@ def email_ext(parser, xml_parent, data):
'subject', '$DEFAULT_SUBJECT') 'subject', '$DEFAULT_SUBJECT')
XML.SubElement(emailext, 'defaultContent').text = data.get( XML.SubElement(emailext, 'defaultContent').text = data.get(
'body', '$DEFAULT_CONTENT') 'body', '$DEFAULT_CONTENT')
XML.SubElement(emailext, 'attachmentsPattern').text = '' XML.SubElement(emailext, 'attachmentsPattern').text = data.get(
'attachments', '')
XML.SubElement(emailext, 'presendScript').text = '' XML.SubElement(emailext, 'presendScript').text = ''
XML.SubElement(emailext, 'attachBuildLog').text = \ XML.SubElement(emailext, 'attachBuildLog').text = \
str(data.get('attach-build-log', False)).lower() str(data.get('attach-build-log', False)).lower()

View File

@ -140,7 +140,7 @@
<contentType>default</contentType> <contentType>default</contentType>
<defaultSubject>Subject for Build ${BUILD_NUMBER}</defaultSubject> <defaultSubject>Subject for Build ${BUILD_NUMBER}</defaultSubject>
<defaultContent>The build has finished</defaultContent> <defaultContent>The build has finished</defaultContent>
<attachmentsPattern/> <attachmentsPattern>*/foo*.log</attachmentsPattern>
<presendScript/> <presendScript/>
<attachBuildLog>false</attachBuildLog> <attachBuildLog>false</attachBuildLog>
<replyTo>foo@example.com</replyTo> <replyTo>foo@example.com</replyTo>

View File

@ -5,6 +5,7 @@ publishers:
subject: Subject for Build ${BUILD_NUMBER} subject: Subject for Build ${BUILD_NUMBER}
body: The build has finished body: The build has finished
attach-build-log: false attach-build-log: false
attachments: "*/foo*.log"
unstable: true unstable: true
first-failure: true first-failure: true
not-built: true not-built: true