add post-send script option

We need post-send script option to configure presendScript in the
generated configure xml.
When setting post-send as below:
   postsend-script: $DEFAULT_POSTSEND_SCRIPT
We could see below informaton in the generated configure xml.
<hudson.plugins.emailext.ExtendedEmailPublisher plugin="email-ext@2.42">
 <postsendScript>$DEFAULT_POSTSEND_SCRIPT</postsendScript>
</hudson.plugins.emailext.ExtendedEmailPublisher>

Change-Id: Ic215b2f3a9b5e7361a2cc1772226382da341ecd1
Signed-off-by: Liu Changcheng <changcheng.liu@intel.com>
Signed-off-by: Jerry Liu <primerlink@gmail.com>
This commit is contained in:
Liu Changcheng 2016-08-17 13:48:32 +08:00
parent 3c57feb005
commit c588b842e8
5 changed files with 8 additions and 0 deletions

View File

@ -1913,6 +1913,8 @@ def email_ext(parser, xml_parent, data):
:arg bool pre-build: Send an email before the build (default false) :arg bool pre-build: Send an email before the build (default false)
:arg str presend-script: A Groovy script executed prior sending the mail. :arg str presend-script: A Groovy script executed prior sending the mail.
(default '') (default '')
:arg str postsend-script: A Goovy script executed after sending the email.
(default '')
:arg bool save-output: Save email content to workspace (default false) :arg bool save-output: Save email content to workspace (default false)
:arg str matrix-trigger: If using matrix projects, when to trigger :arg str matrix-trigger: If using matrix projects, when to trigger
@ -1990,6 +1992,8 @@ def email_ext(parser, xml_parent, data):
'attachments', '') 'attachments', '')
XML.SubElement(emailext, 'presendScript').text = data.get( XML.SubElement(emailext, 'presendScript').text = data.get(
'presend-script', '') 'presend-script', '')
XML.SubElement(emailext, 'postsendScript').text = data.get(
'postsend-script', '')
XML.SubElement(emailext, 'attachBuildLog').text = str(data.get( XML.SubElement(emailext, 'attachBuildLog').text = str(data.get(
'attach-build-log', False)).lower() 'attach-build-log', False)).lower()
XML.SubElement(emailext, 'compressBuildLog').text = str(data.get( XML.SubElement(emailext, 'compressBuildLog').text = str(data.get(

View File

@ -164,6 +164,7 @@
<defaultContent>The build has finished</defaultContent> <defaultContent>The build has finished</defaultContent>
<attachmentsPattern>*/foo*.log</attachmentsPattern> <attachmentsPattern>*/foo*.log</attachmentsPattern>
<presendScript>cancel=true</presendScript> <presendScript>cancel=true</presendScript>
<postsendScript>cancel=true</postsendScript>
<attachBuildLog>false</attachBuildLog> <attachBuildLog>false</attachBuildLog>
<compressBuildLog>false</compressBuildLog> <compressBuildLog>false</compressBuildLog>
<saveOutput>true</saveOutput> <saveOutput>true</saveOutput>

View File

@ -24,6 +24,7 @@ publishers:
pre-build: true pre-build: true
matrix-trigger: only-configurations matrix-trigger: only-configurations
presend-script: "cancel=true" presend-script: "cancel=true"
postsend-script: "cancel=true"
save-output: true save-output: true
send-to: send-to:
- developers - developers

View File

@ -21,6 +21,7 @@
<defaultContent>The build has finished</defaultContent> <defaultContent>The build has finished</defaultContent>
<attachmentsPattern>*/foo*.log</attachmentsPattern> <attachmentsPattern>*/foo*.log</attachmentsPattern>
<presendScript/> <presendScript/>
<postsendScript/>
<attachBuildLog>true</attachBuildLog> <attachBuildLog>true</attachBuildLog>
<compressBuildLog>true</compressBuildLog> <compressBuildLog>true</compressBuildLog>
<saveOutput>false</saveOutput> <saveOutput>false</saveOutput>

View File

@ -32,6 +32,7 @@
<defaultContent>$DEFAULT_CONTENT</defaultContent> <defaultContent>$DEFAULT_CONTENT</defaultContent>
<attachmentsPattern/> <attachmentsPattern/>
<presendScript/> <presendScript/>
<postsendScript/>
<attachBuildLog>false</attachBuildLog> <attachBuildLog>false</attachBuildLog>
<compressBuildLog>false</compressBuildLog> <compressBuildLog>false</compressBuildLog>
<saveOutput>false</saveOutput> <saveOutput>false</saveOutput>