Doing complex stuff in jelly is a pain in the butt in my opinion, which is why I implemented generating emails using groovy (and other scripting languages), I have done something similar to what you are trying to do using the groovy scripting. As for the other item, you can add attachments to the email using the attachments pattern in the project setup.
Email-ext allows you to use a script already, so its all part of that. I need to update the wiki still on how to use it. I will do that tomorrow when I am back from the land of no computers.
+ cppncss -d -k -r -x src
Build step 'Execute shell' marked build as failure
ERROR: Publisher hudson.plugins.cppncss.CppNCSSPublisher aborted due to exception
hudson.util.IOException2: only whitespace content allowed before start tag and not / (position: START_DOCUMENT seen /... @1:1)
at hudson.plugins.helpers.BuildProxy.unwrapException(BuildProxy.java:104)
at hudson.plugins.helpers.BuildProxy.doPerform(BuildProxy.java:77)
at hudson.plugins.helpers.AbstractPublisherImpl.perform(AbstractPublisherImpl.java:30)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:694)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:669)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:647)
at hudson.model.Build$RunnerImpl.post2(Build.java:162)
at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:616)
at hudson.model.Run.run(Run.java:1429)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:230)
Caused by: java.lang.Exception: hudson.util.IOException2: only whitespace content allowed before start tag and not / (position: START_DOCUMENT seen /... @1:1)
at hudson.plugins.helpers.BuildProxyCallableHelper.call(BuildProxyCallableHelper.java:54)
at hudson.plugins.helpers.BuildProxyCallableHelper.call(BuildProxyCallableHelper.java:15)
at hudson.FilePath.act(FilePath.java:813)
at hudson.plugins.helpers.BuildProxy.doPerform(BuildProxy.java:68)
... 11 more
Caused by: hudson.util.IOException2: only whitespace content allowed before start tag and not / (position: START_DOCUMENT seen /... @1:1)
at hudson.plugins.cppncss.parser.Statistic.parse(Statistic.java:152)
at hudson.plugins.cppncss.CppNCSSGhostwriter.performFromSlave(CppNCSSGhostwriter.java:79)
at hudson.plugins.helpers.BuildProxyCallableHelper.call(BuildProxyCallableHelper.java:51)
... 14 more
Caused by: org.xmlpull.v1.XmlPullParserException: only whitespace content allowed before start tag and not / (position: START_DOCUMENT seen /... @1:1)
at org.xmlpull.mxp1.MXParser.parseProlog(MXParser.java:1519)
at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1395)
at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)
at hudson.plugins.cppncss.parser.Statistic.expectNextTag(Statistic.java:194)
at hudson.plugins.cppncss.parser.Statistic.parse(Statistic.java:48)
... 16 more
<%
// the goal is to find the top level job which should contain the changelist
def upstreamBuild = null
def cause = build.causes.find {
if(it instanceof hudson.model.Cause.UpstreamCause) {
return true
}
return false
}
while(cause != null) {
upstreamBuild =
hudson.model.Hudson.instance.getItem(cause.upstreamProject).getBuildByNumber(cause.upstreamBuild)
cause = upstreamBuild.causes.find {
if(it instanceof hudson.model.Cause.UpstreamCause) {
return true
}
return false
}
}
%>
<!-- CHANGE SET -->
<%
if(upstreamBuild != null) {
// now do stuff with that upstream build
}
%>
...
--
slide-o-blog
http://slide-o-blog.blogspot.com/
You need to fill in the argument names as well ${SCRIPT, template="template.template"}
If you don't need any different script, you can just supply a template that will automatically get processed with the default groovy script. The template can include groovy script code which is where you would put something like I provided.
I'm working on the wiki.