Help with extendedEmail and configure

83 views
Skip to first unread message

Carlos Lucas

unread,
Feb 12, 2015, 2:32:35 AM2/12/15
to job-dsl...@googlegroups.com
Hi, 

I have a problem with the extendedEmail. I would like to add the console build log attached to mail. I haven't seen any way to do this with job DSL so I tried to make a configure block that do so.
Here is the code:

public static Closure attachLog() {
   
return {      
           it
/ 'publishers' / 'hudson.plugins.emailext.ExtendedEmailPublisher' {
                    attachBuildLog
true
                    compressBuildLog
true
           
}
   
}
}


job
{
  name
'job'
  description
'Build and test the app.'
  publishers
{
       extendedEmail
'Recipient', 'Subject', 'Content',  
       
{ trigger triggerName: 'Failure', sendToRequester: true }
       configure attachLog
()
   
}
}

But the result is a new node named hudson.plugins.emailext.ExtendedEmailPublisher with the attachBuildLog and compressBuildLog childs instead of put those childs into the existing  hudson.plugins.emailext.ExtendedEmailPublisher node.

 <publishers>
       
<hudson.plugins.emailext.ExtendedEmailPublisher>
           
<attachBuildLog>true</attachBuildLog>
           
<compressBuildLog>true</compressBuildLog>
       
</hudson.plugins.emailext.ExtendedEmailPublisher>
       
<hudson.plugins.emailext.ExtendedEmailPublisher>
           
<recipientList>Recipient</recipientList>
           
<contentType>default</contentType>
           
<defaultSubject>Subject</defaultSubject>
           
<defaultContent>Content</defaultContent>
           
<attachmentsPattern></attachmentsPattern>
           
<configuredTriggers>
               
<hudson.plugins.emailext.plugins.trigger.FailureTrigger>
                   
<email>
                       
<recipientList></recipientList>
                       
<subject>$PROJECT_DEFAULT_SUBJECT</subject>
                       
<body>$PROJECT_DEFAULT_CONTENT</body>
                       
<sendToDevelopers>false</sendToDevelopers>
                       
<sendToRequester>true</sendToRequester>
                       
<includeCulprits>false</includeCulprits>
                       
<sendToRecipientList>true</sendToRecipientList>
                   
</email>
               
</hudson.plugins.emailext.plugins.trigger.FailureTrigger>
           
</configuredTriggers>
       
</hudson.plugins.emailext.ExtendedEmailPublisher>
   
</publishers>


Can you tell me what's wrong with the code?

Thank you!
Regards.

Daniel Spilker

unread,
Feb 12, 2015, 3:10:31 AM2/12/15
to job-dsl...@googlegroups.com
Hi,

extendedEmail has it's own configure block which in this case is easier to use than the top-level one:

job {
  name 'job'
  description 'Build and test the app.'
  publishers {
    extendedEmail('Recipient', 'Subject', 'Content') {
      trigger(triggerName: 'Failure', sendToRequester: true)
      configure
{     
        it / attachBuildLog(true)
        it / compressBuildLog(true)
      }
    }
  }
}

Daniel

--
You received this message because you are subscribed to the Google Groups "job-dsl-plugin" group.
To unsubscribe from this group and stop receiving emails from it, send an email to job-dsl-plugi...@googlegroups.com.
To post to this group, send email to job-dsl...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/job-dsl-plugin/6f43a34c-9301-4f8c-bc94-9a080ac5560a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages