Merge "email-ext trigger script"
This commit is contained in:
commit
150705cf50
@ -1926,6 +1926,8 @@ def base_email_ext(registry, xml_parent, data, ttype):
|
|||||||
XML.SubElement(email, 'sendToDevelopers').text = 'false'
|
XML.SubElement(email, 'sendToDevelopers').text = 'false'
|
||||||
XML.SubElement(email, 'includeCulprits').text = 'false'
|
XML.SubElement(email, 'includeCulprits').text = 'false'
|
||||||
XML.SubElement(email, 'sendToRecipientList').text = 'true'
|
XML.SubElement(email, 'sendToRecipientList').text = 'true'
|
||||||
|
if ttype == 'ScriptTrigger':
|
||||||
|
XML.SubElement(trigger, 'triggerScript').text = data['trigger-script']
|
||||||
|
|
||||||
|
|
||||||
def email_ext(registry, xml_parent, data):
|
def email_ext(registry, xml_parent, data):
|
||||||
@ -1977,6 +1979,8 @@ def email_ext(registry, xml_parent, data):
|
|||||||
:arg bool still-unstable: Send an email if the build is still unstable
|
:arg bool still-unstable: Send an email if the build is still unstable
|
||||||
(default false)
|
(default false)
|
||||||
: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 trigger-script: A Groovy script used to determine if an email
|
||||||
|
should be sent.
|
||||||
: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.
|
:arg str postsend-script: A Goovy script executed after sending the email.
|
||||||
@ -2037,6 +2041,8 @@ def email_ext(registry, xml_parent, data):
|
|||||||
base_email_ext(registry, ctrigger, data, 'StillUnstableTrigger')
|
base_email_ext(registry, ctrigger, data, 'StillUnstableTrigger')
|
||||||
if data.get('pre-build', False):
|
if data.get('pre-build', False):
|
||||||
base_email_ext(registry, ctrigger, data, 'PreBuildTrigger')
|
base_email_ext(registry, ctrigger, data, 'PreBuildTrigger')
|
||||||
|
if data.get('trigger-script', False):
|
||||||
|
base_email_ext(registry, ctrigger, data, 'ScriptTrigger')
|
||||||
|
|
||||||
content_type_mime = {
|
content_type_mime = {
|
||||||
'text': 'text/plain',
|
'text': 'text/plain',
|
||||||
|
188
tests/publishers/fixtures/email-ext003.xml
Normal file
188
tests/publishers/fixtures/email-ext003.xml
Normal file
@ -0,0 +1,188 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<project>
|
||||||
|
<publishers>
|
||||||
|
<hudson.plugins.emailext.ExtendedEmailPublisher>
|
||||||
|
<recipientList>foo@example.com, bar@example.com</recipientList>
|
||||||
|
<configuredTriggers>
|
||||||
|
<hudson.plugins.emailext.plugins.trigger.AlwaysTrigger>
|
||||||
|
<email>
|
||||||
|
<recipientList/>
|
||||||
|
<subject>$PROJECT_DEFAULT_SUBJECT</subject>
|
||||||
|
<body>$PROJECT_DEFAULT_CONTENT</body>
|
||||||
|
<sendToDevelopers>true</sendToDevelopers>
|
||||||
|
<sendToRequester>true</sendToRequester>
|
||||||
|
<includeCulprits>true</includeCulprits>
|
||||||
|
<sendToRecipientList>true</sendToRecipientList>
|
||||||
|
</email>
|
||||||
|
</hudson.plugins.emailext.plugins.trigger.AlwaysTrigger>
|
||||||
|
<hudson.plugins.emailext.plugins.trigger.UnstableTrigger>
|
||||||
|
<email>
|
||||||
|
<recipientList/>
|
||||||
|
<subject>$PROJECT_DEFAULT_SUBJECT</subject>
|
||||||
|
<body>$PROJECT_DEFAULT_CONTENT</body>
|
||||||
|
<sendToDevelopers>true</sendToDevelopers>
|
||||||
|
<sendToRequester>true</sendToRequester>
|
||||||
|
<includeCulprits>true</includeCulprits>
|
||||||
|
<sendToRecipientList>true</sendToRecipientList>
|
||||||
|
</email>
|
||||||
|
</hudson.plugins.emailext.plugins.trigger.UnstableTrigger>
|
||||||
|
<hudson.plugins.emailext.plugins.trigger.FirstFailureTrigger>
|
||||||
|
<email>
|
||||||
|
<recipientList/>
|
||||||
|
<subject>$PROJECT_DEFAULT_SUBJECT</subject>
|
||||||
|
<body>$PROJECT_DEFAULT_CONTENT</body>
|
||||||
|
<sendToDevelopers>true</sendToDevelopers>
|
||||||
|
<sendToRequester>true</sendToRequester>
|
||||||
|
<includeCulprits>true</includeCulprits>
|
||||||
|
<sendToRecipientList>true</sendToRecipientList>
|
||||||
|
</email>
|
||||||
|
</hudson.plugins.emailext.plugins.trigger.FirstFailureTrigger>
|
||||||
|
<hudson.plugins.emailext.plugins.trigger.NotBuiltTrigger>
|
||||||
|
<email>
|
||||||
|
<recipientList/>
|
||||||
|
<subject>$PROJECT_DEFAULT_SUBJECT</subject>
|
||||||
|
<body>$PROJECT_DEFAULT_CONTENT</body>
|
||||||
|
<sendToDevelopers>true</sendToDevelopers>
|
||||||
|
<sendToRequester>true</sendToRequester>
|
||||||
|
<includeCulprits>true</includeCulprits>
|
||||||
|
<sendToRecipientList>true</sendToRecipientList>
|
||||||
|
</email>
|
||||||
|
</hudson.plugins.emailext.plugins.trigger.NotBuiltTrigger>
|
||||||
|
<hudson.plugins.emailext.plugins.trigger.AbortedTrigger>
|
||||||
|
<email>
|
||||||
|
<recipientList/>
|
||||||
|
<subject>$PROJECT_DEFAULT_SUBJECT</subject>
|
||||||
|
<body>$PROJECT_DEFAULT_CONTENT</body>
|
||||||
|
<sendToDevelopers>true</sendToDevelopers>
|
||||||
|
<sendToRequester>true</sendToRequester>
|
||||||
|
<includeCulprits>true</includeCulprits>
|
||||||
|
<sendToRecipientList>true</sendToRecipientList>
|
||||||
|
</email>
|
||||||
|
</hudson.plugins.emailext.plugins.trigger.AbortedTrigger>
|
||||||
|
<hudson.plugins.emailext.plugins.trigger.RegressionTrigger>
|
||||||
|
<email>
|
||||||
|
<recipientList/>
|
||||||
|
<subject>$PROJECT_DEFAULT_SUBJECT</subject>
|
||||||
|
<body>$PROJECT_DEFAULT_CONTENT</body>
|
||||||
|
<sendToDevelopers>true</sendToDevelopers>
|
||||||
|
<sendToRequester>true</sendToRequester>
|
||||||
|
<includeCulprits>true</includeCulprits>
|
||||||
|
<sendToRecipientList>true</sendToRecipientList>
|
||||||
|
</email>
|
||||||
|
</hudson.plugins.emailext.plugins.trigger.RegressionTrigger>
|
||||||
|
<hudson.plugins.emailext.plugins.trigger.FailureTrigger>
|
||||||
|
<email>
|
||||||
|
<recipientList/>
|
||||||
|
<subject>$PROJECT_DEFAULT_SUBJECT</subject>
|
||||||
|
<body>$PROJECT_DEFAULT_CONTENT</body>
|
||||||
|
<sendToDevelopers>true</sendToDevelopers>
|
||||||
|
<sendToRequester>true</sendToRequester>
|
||||||
|
<includeCulprits>true</includeCulprits>
|
||||||
|
<sendToRecipientList>true</sendToRecipientList>
|
||||||
|
</email>
|
||||||
|
</hudson.plugins.emailext.plugins.trigger.FailureTrigger>
|
||||||
|
<hudson.plugins.emailext.plugins.trigger.SecondFailureTrigger>
|
||||||
|
<email>
|
||||||
|
<recipientList/>
|
||||||
|
<subject>$PROJECT_DEFAULT_SUBJECT</subject>
|
||||||
|
<body>$PROJECT_DEFAULT_CONTENT</body>
|
||||||
|
<sendToDevelopers>true</sendToDevelopers>
|
||||||
|
<sendToRequester>true</sendToRequester>
|
||||||
|
<includeCulprits>true</includeCulprits>
|
||||||
|
<sendToRecipientList>true</sendToRecipientList>
|
||||||
|
</email>
|
||||||
|
</hudson.plugins.emailext.plugins.trigger.SecondFailureTrigger>
|
||||||
|
<hudson.plugins.emailext.plugins.trigger.ImprovementTrigger>
|
||||||
|
<email>
|
||||||
|
<recipientList/>
|
||||||
|
<subject>$PROJECT_DEFAULT_SUBJECT</subject>
|
||||||
|
<body>$PROJECT_DEFAULT_CONTENT</body>
|
||||||
|
<sendToDevelopers>true</sendToDevelopers>
|
||||||
|
<sendToRequester>true</sendToRequester>
|
||||||
|
<includeCulprits>true</includeCulprits>
|
||||||
|
<sendToRecipientList>true</sendToRecipientList>
|
||||||
|
</email>
|
||||||
|
</hudson.plugins.emailext.plugins.trigger.ImprovementTrigger>
|
||||||
|
<hudson.plugins.emailext.plugins.trigger.StillFailingTrigger>
|
||||||
|
<email>
|
||||||
|
<recipientList/>
|
||||||
|
<subject>$PROJECT_DEFAULT_SUBJECT</subject>
|
||||||
|
<body>$PROJECT_DEFAULT_CONTENT</body>
|
||||||
|
<sendToDevelopers>true</sendToDevelopers>
|
||||||
|
<sendToRequester>true</sendToRequester>
|
||||||
|
<includeCulprits>true</includeCulprits>
|
||||||
|
<sendToRecipientList>true</sendToRecipientList>
|
||||||
|
</email>
|
||||||
|
</hudson.plugins.emailext.plugins.trigger.StillFailingTrigger>
|
||||||
|
<hudson.plugins.emailext.plugins.trigger.SuccessTrigger>
|
||||||
|
<email>
|
||||||
|
<recipientList/>
|
||||||
|
<subject>$PROJECT_DEFAULT_SUBJECT</subject>
|
||||||
|
<body>$PROJECT_DEFAULT_CONTENT</body>
|
||||||
|
<sendToDevelopers>true</sendToDevelopers>
|
||||||
|
<sendToRequester>true</sendToRequester>
|
||||||
|
<includeCulprits>true</includeCulprits>
|
||||||
|
<sendToRecipientList>true</sendToRecipientList>
|
||||||
|
</email>
|
||||||
|
</hudson.plugins.emailext.plugins.trigger.SuccessTrigger>
|
||||||
|
<hudson.plugins.emailext.plugins.trigger.FixedTrigger>
|
||||||
|
<email>
|
||||||
|
<recipientList/>
|
||||||
|
<subject>$PROJECT_DEFAULT_SUBJECT</subject>
|
||||||
|
<body>$PROJECT_DEFAULT_CONTENT</body>
|
||||||
|
<sendToDevelopers>true</sendToDevelopers>
|
||||||
|
<sendToRequester>true</sendToRequester>
|
||||||
|
<includeCulprits>true</includeCulprits>
|
||||||
|
<sendToRecipientList>true</sendToRecipientList>
|
||||||
|
</email>
|
||||||
|
</hudson.plugins.emailext.plugins.trigger.FixedTrigger>
|
||||||
|
<hudson.plugins.emailext.plugins.trigger.StillUnstableTrigger>
|
||||||
|
<email>
|
||||||
|
<recipientList/>
|
||||||
|
<subject>$PROJECT_DEFAULT_SUBJECT</subject>
|
||||||
|
<body>$PROJECT_DEFAULT_CONTENT</body>
|
||||||
|
<sendToDevelopers>true</sendToDevelopers>
|
||||||
|
<sendToRequester>true</sendToRequester>
|
||||||
|
<includeCulprits>true</includeCulprits>
|
||||||
|
<sendToRecipientList>true</sendToRecipientList>
|
||||||
|
</email>
|
||||||
|
</hudson.plugins.emailext.plugins.trigger.StillUnstableTrigger>
|
||||||
|
<hudson.plugins.emailext.plugins.trigger.PreBuildTrigger>
|
||||||
|
<email>
|
||||||
|
<recipientList/>
|
||||||
|
<subject>$PROJECT_DEFAULT_SUBJECT</subject>
|
||||||
|
<body>$PROJECT_DEFAULT_CONTENT</body>
|
||||||
|
<sendToDevelopers>true</sendToDevelopers>
|
||||||
|
<sendToRequester>true</sendToRequester>
|
||||||
|
<includeCulprits>true</includeCulprits>
|
||||||
|
<sendToRecipientList>true</sendToRecipientList>
|
||||||
|
</email>
|
||||||
|
</hudson.plugins.emailext.plugins.trigger.PreBuildTrigger>
|
||||||
|
<hudson.plugins.emailext.plugins.trigger.ScriptTrigger>
|
||||||
|
<email>
|
||||||
|
<recipientList/>
|
||||||
|
<subject>$PROJECT_DEFAULT_SUBJECT</subject>
|
||||||
|
<body>$PROJECT_DEFAULT_CONTENT</body>
|
||||||
|
<sendToDevelopers>true</sendToDevelopers>
|
||||||
|
<sendToRequester>true</sendToRequester>
|
||||||
|
<includeCulprits>true</includeCulprits>
|
||||||
|
<sendToRecipientList>true</sendToRecipientList>
|
||||||
|
</email>
|
||||||
|
<triggerScript>build.result.toString().equals('SUCCESS')</triggerScript>
|
||||||
|
</hudson.plugins.emailext.plugins.trigger.ScriptTrigger>
|
||||||
|
</configuredTriggers>
|
||||||
|
<contentType>text/html</contentType>
|
||||||
|
<defaultSubject>Subject for Build ${BUILD_NUMBER}</defaultSubject>
|
||||||
|
<defaultContent>The build has finished</defaultContent>
|
||||||
|
<attachmentsPattern>*/foo*.log</attachmentsPattern>
|
||||||
|
<presendScript>cancel=true</presendScript>
|
||||||
|
<postsendScript>cancel=true</postsendScript>
|
||||||
|
<attachBuildLog>false</attachBuildLog>
|
||||||
|
<compressBuildLog>false</compressBuildLog>
|
||||||
|
<saveOutput>true</saveOutput>
|
||||||
|
<disabled>false</disabled>
|
||||||
|
<replyTo>foo@example.com</replyTo>
|
||||||
|
<matrixTriggerMode>ONLY_CONFIGURATIONS</matrixTriggerMode>
|
||||||
|
</hudson.plugins.emailext.ExtendedEmailPublisher>
|
||||||
|
</publishers>
|
||||||
|
</project>
|
34
tests/publishers/fixtures/email-ext003.yaml
Normal file
34
tests/publishers/fixtures/email-ext003.yaml
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
publishers:
|
||||||
|
- email-ext:
|
||||||
|
recipients: foo@example.com, bar@example.com
|
||||||
|
reply-to: foo@example.com
|
||||||
|
content-type: html
|
||||||
|
subject: Subject for Build ${BUILD_NUMBER}
|
||||||
|
body: The build has finished
|
||||||
|
attach-build-log: false
|
||||||
|
compress-log: false
|
||||||
|
attachments: "*/foo*.log"
|
||||||
|
always: true
|
||||||
|
unstable: true
|
||||||
|
first-failure: true
|
||||||
|
not-built: true
|
||||||
|
aborted: true
|
||||||
|
regression: true
|
||||||
|
failure: true
|
||||||
|
second-failure: true
|
||||||
|
improvement: true
|
||||||
|
still-failing: true
|
||||||
|
success: true
|
||||||
|
fixed: true
|
||||||
|
still-unstable: true
|
||||||
|
pre-build: true
|
||||||
|
trigger-script: "build.result.toString().equals('SUCCESS')"
|
||||||
|
matrix-trigger: only-configurations
|
||||||
|
presend-script: "cancel=true"
|
||||||
|
postsend-script: "cancel=true"
|
||||||
|
save-output: true
|
||||||
|
send-to:
|
||||||
|
- developers
|
||||||
|
- requester
|
||||||
|
- culprits
|
||||||
|
- recipients
|
Loading…
Reference in New Issue
Block a user