How to send a daily summary by email?

43 views
Skip to first unread message

Ana MB

unread,
Dec 12, 2017, 6:16:01 AM12/12/17
to Jenkins Users
Hi guys!

I would like to send an email with a summary of my tests (both failed and success build) and I would like to send it daily. Is it possible?
I've been looking for a plugin, and I've found: "Summary Display Plugin", but it's not what I need...

Does anybody know how to do it?

Thanks so much!!!

Victor Martinez

unread,
Dec 12, 2017, 2:58:16 PM12/12/17
to Jenkins Users
I'm not sure whether there is any specific plugin for that, if so, hope someone else can answer it. 

In any case, you can write your own groovy script to generate those details, something like the below snippet, but you need to add the filter of the builds executed in the last day or so.

Jenkins.instance?.items.each {
  try {
    // TODO: filter based on the specific time, further details:  http://javadoc.jenkins-ci.org/hudson/model/Run.html#getTimestamp--
    it.builds.each { build ->
      build.getActions(hudson.tasks.junit.TestResultAction).each {action ->
        println it.name
        println "Build ran: ${build.getTime()}"
        println "total: ${action.getTotalCount()} failed: ${action.getFailCount()} skipt ${action.getSkipCount()}"
      }
    }
  } catch (groovy.lang.MissingPropertyException mpe) {
    println "This item is not supported: ${it.name}" 
  }
}


If you copy&paste the below snippet in your jenkins_instance/script then you can see how it looks like. 


Cheers
Reply all
Reply to author
Forward
0 new messages