[JIRA] (JENKINS-37886) is it possible to send email notification from a pipeline

0 views
Skip to first unread message

dearpedda@gmail.com (JIRA)

unread,
Sep 1, 2016, 6:12:10 AM9/1/16
to jenkinsc...@googlegroups.com
Pedda Reddy created an issue
 
Jenkins / Task JENKINS-37886
is it possible to send email notification from a pipeline
Issue Type: Task Task
Assignee: Oleg Nenashev
Components: _unsorted
Created: 2016/Sep/01 10:11 AM
Priority: Minor Minor
Reporter: Pedda Reddy

Is it possible to send an email notification in pipeline, based on the completion of pipeline segments I want to send out emails. the mail-ext plugin doesn't show any options when I create a job with pipeline. I'm checking if I can acheieve the same using groovy scripting, but no headway so far.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

dearpedda@gmail.com (JIRA)

unread,
Sep 1, 2016, 6:13:01 AM9/1/16
to jenkinsc...@googlegroups.com

o.v.nenashev@gmail.com (JIRA)

unread,
Sep 13, 2016, 10:52:04 AM9/13/16
to jenkinsc...@googlegroups.com

dearpedda@gmail.com (JIRA)

unread,
Sep 16, 2016, 5:12:01 AM9/16/16
to jenkinsc...@googlegroups.com

dearpedda@gmail.com (JIRA)

unread,
Sep 16, 2016, 5:59:01 AM9/16/16
to jenkinsc...@googlegroups.com
Pedda Reddy edited a comment on Task JENKINS-37886
Thanks Nenashev ! I'm able to use the mail step. But, I'm facing issue after I included mail step in my pipeline script.

Please find below the script.

[node
{
    
   def applicationConfigObj
   def tibcoAppConfGenertorObj
   //def notifyObj
   
   stage 'TibcoConfig'
   echo 'Reading Tibco configuration!'
   
    def parent = getClass().getClassLoader()
    def loader = new GroovyClassLoader(parent)

applicationConfigObj = loader.parseClass(new File("/opt/tibco/deploy_tool/Tibco_Automation/src/com/merck/comet/ApplicationConfig.groovy")).newInstance()
tibcoAppConfGenertorObj = loader.parseClass(new File("/opt/tibco/deploy_tool/Tibco_Automation/src/com/merck/comet/TibcoAppConfGenertor.groovy")).newInstance()
    //notifyObj = loader.parseClass(new File("/opt/tibco/deploy_tool/Tibco_Automation/src/com/merck/comet/Notification.groovy")).newInstance()

//tibcoAppConfGenertorObj.generateServiceXML()

    //def sendTo = "peddared...@company.com,peddar...@company.com";
    //println(sendTo)
    //notifyObj.sendNotification();

mail (to: 'peddared...@merck.com',
         subject: "Job '${env.JOB_NAME}' (${env.BUILD_NUMBER}) is waiting for input",
         body: "Please go to ${env.BUILD_URL}.");
     input 'Ready to go?';
    
    

    stage 'ApplicationDownTime'
    echo 'Application DownTime goes here!'
    

    stage 'RetryDownTimeActivities'
    echo 'Retry goes here!'
    
    stage 'Notify'
    echo 'Notifying to group of users!'
}
]

The above script is able to send the email, but the job is failing with below exception. Should the mail step be separate always ?

Exception Below

river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967)
at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
at org.jboss.marshalling.river.BlockMarshaller.doWriteObject(BlockMarshaller.java:65)
at org.jboss.marshalling.river.BlockMarshaller.writeObject(BlockMarshaller.java:56)
at org.jboss.marshalling.MarshallerObjectOutputStream.writeObjectOverride(MarshallerObjectOutputStream.java:50)
at org.jboss.marshalling.river.RiverObjectOutputStream.writeObjectOverride(RiverObjectOutputStream.java:179)

dearpedda@gmail.com (JIRA)

unread,
Sep 16, 2016, 6:05:01 AM9/16/16
to jenkinsc...@googlegroups.com
java.io.NotSerializableException: com.merck.comet.TibcoAppConfGenertor
at org.jboss.marshalling.
river.RiverMarshaller. doWriteObject(RiverMarshaller.java:860)

at org.jboss.marshalling.river.BlockMarshaller.doWriteObject(BlockMarshaller.java:65)
at org.jboss.marshalling.river.BlockMarshaller.writeObject(BlockMarshaller.java:56)
at org.jboss.marshalling.MarshallerObjectOutputStream.writeObjectOverride(MarshallerObjectOutputStream.java:50)
at org.jboss.marshalling.river.RiverObjectOutputStream.writeObjectOverride(RiverObjectOutputStream.java:179)
at java.io.ObjectOutputStream.writeObject(Unknown Source)
at java.util.HashMap.writeObject(Unknown Source)
at sun.reflect.GeneratedMethodAccessor53.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:271)
at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:976)
at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)

river.RiverMarshaller.
doWriteFields(RiverMarshaller.java:1032)

at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967)
at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
at org.jboss.marshalling.river.BlockMarshaller.doWriteObject(BlockMarshaller.java:65)
at org.jboss.marshalling.river.BlockMarshaller.writeObject(BlockMarshaller.java:56)
at org.jboss.marshalling.MarshallerObjectOutputStream.writeObjectOverride(MarshallerObjectOutputStream.java:50)
at org.jboss.marshalling.river.RiverObjectOutputStream.writeObjectOverride(RiverObjectOutputStream.java:179)

o.v.nenashev@gmail.com (JIRA)

unread,
Jan 31, 2017, 7:06:01 PM1/31/17
to jenkinsc...@googlegroups.com

Pipeline is not a pure Groovy. The context is being serialized to the disk on each step to make it survive over restarts. If it something really required for temporary needs, implement the code within a method with NonCPS annotation

o.v.nenashev@gmail.com (JIRA)

unread,
Jan 31, 2017, 7:07:01 PM1/31/17
to jenkinsc...@googlegroups.com
Oleg Nenashev resolved as Not A Defect
 
Change By: Oleg Nenashev
Status: Open Resolved
Resolution: Not A Defect

o.v.nenashev@gmail.com (JIRA)

unread,
Jan 31, 2017, 7:07:01 PM1/31/17
to jenkinsc...@googlegroups.com
Oleg Nenashev updated an issue
Change By: Oleg Nenashev
Component/s: pipeline
Component/s: _unsorted

jenkins.js@crypt.se (JIRA)

unread,
Mar 14, 2017, 3:12:01 AM3/14/17
to jenkinsc...@googlegroups.com
Johan Svensson commented on Task JENKINS-37886
 
Re: is it possible to send email notification from a pipeline

What is the cleanest way of sending an email to all committers involved in an SCM change that triggered a pipeline where a step fails?

This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages