diff --git a/jenkins_jobs/modules/publishers.py b/jenkins_jobs/modules/publishers.py
index 6700e6854..06ca5c00d 100644
--- a/jenkins_jobs/modules/publishers.py
+++ b/jenkins_jobs/modules/publishers.py
@@ -1388,6 +1388,7 @@ def email_ext(parser, xml_parent, data):
like ${BUILD_NUMBER}, but the real magic is using groovy or
javascript to hook into the Jenkins API itself
: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 first-failure: Send an email for just the first failure
(default false)
@@ -1451,7 +1452,8 @@ def email_ext(parser, xml_parent, data):
'subject', '$DEFAULT_SUBJECT')
XML.SubElement(emailext, 'defaultContent').text = data.get(
'body', '$DEFAULT_CONTENT')
- XML.SubElement(emailext, 'attachmentsPattern').text = ''
+ XML.SubElement(emailext, 'attachmentsPattern').text = data.get(
+ 'attachments', '')
XML.SubElement(emailext, 'presendScript').text = ''
XML.SubElement(emailext, 'attachBuildLog').text = \
str(data.get('attach-build-log', False)).lower()
diff --git a/tests/publishers/fixtures/email-ext001.xml b/tests/publishers/fixtures/email-ext001.xml
index 7d87cb03b..2af3c6980 100644
--- a/tests/publishers/fixtures/email-ext001.xml
+++ b/tests/publishers/fixtures/email-ext001.xml
@@ -140,7 +140,7 @@
default
Subject for Build ${BUILD_NUMBER}
The build has finished
-
+ */foo*.log
false
foo@example.com
diff --git a/tests/publishers/fixtures/email-ext001.yaml b/tests/publishers/fixtures/email-ext001.yaml
index 6b82336b9..9459f807c 100644
--- a/tests/publishers/fixtures/email-ext001.yaml
+++ b/tests/publishers/fixtures/email-ext001.yaml
@@ -5,6 +5,7 @@ publishers:
subject: Subject for Build ${BUILD_NUMBER}
body: The build has finished
attach-build-log: false
+ attachments: "*/foo*.log"
unstable: true
first-failure: true
not-built: true