Re: email-ext reporting Branch name
build is part of the binding that the email-ext plugin provides (its a variable), it is an instance of AbstractBuild, so I would start with the docs for that to determine what you can do. That's the main thing that the template can interact with, from there you can access properties and information about the build (get the changes from the SCM, etc). Since its basically open season on almost anything in the Jenkins API, there really isn't any documentation available except the JavaDoc or source code. I guess it would be nice to add a "recipe" section to the wiki page, I will consider doing this. I am not familiar with what is available and not, you could certainly access the AbstractProject instance for any other job you have configured and read properties from it. Thanks, slide On Fri, Apr 5, 2013 at 10:02 AM, Kamal Ahmed wrote: > i am having trouble understanding WHERE the tags ${build} , ${changeSet} > are coming from, is there a way to get a list of what tags are available, > and what methods can be used with them, like ${build.changeSet} without > looking at the Jenkins and email-ext Source ? > > Also i just realized that the PATH which contains the "repo" name is ONLY > available if someone checks in a changeset in subversion ( we are using > subversion here ) but with NO changes, i would STILL like to see the repo > name, is there a way to so that ? > > Thanks, > -Kamal. > > > -- > *From:* Slide > *To:* "jenkinsci-users@googlegroups.com" > > *Sent:* Thursday, April 4, 2013 3:14 PM > > *Subject:* Re: email-ext reporting Branch name > > The template files use the syntax of the SimpleTemplateEngine [1] from > Groovy. The email-ext.groovy is the default file that sets up the > SimpleTemplateEngine. I've been meaning to change this so that the script > is not needed, it just sets up some bindings for the template and I don't > believe anyone is changing that file. In the Groovy templates, you can use > code blocks to do operations and use the full Groovy language to do things > intermixed with the output generation. Think along the lines of PHP or JSP > where you have code embedded along with the HTML/rendering. The default > templates have some try/catch blocks and some if/else type blocks, you > could also use the built-in regex support in Groovy to do what you want > with the regex. > > <% > def yourStuff = yourString =~ /someregex/ > %> > > blah blah ${yourStuff} > > > 1 - http://groovy.codehaus.org/Groovy+Templates > > > On Thu, Apr 4, 2013 at 10:45 AM, Kamal Ahmed wrote: > > My only excuse is mostly my lack of groovy knowledge, and how it would > work. > > 1. I see the .groovy files and .template files, which one's should i use : > > ${SCRIPT,template="groovy-html.template"} > > or: > > ${SCRIPT,groovy="email-ext.groovy"} > > > and if we look at jelly vs Groovy: > > Jelly ( html.jelly ) > > > > > > > > > > > > > > > > > BUILD > ${build.result} > Build URL href="${rooturl}${build.url}">${rooturl}${build.url} > Project:${project.name} > Date of build:${it.timestampString} > Build duration:${build.durationString} > > > > in Groovy : (groovy-html.template) > > >SRC="${rooturl}static/e59dfe28/images/32x32/<%= build.result.toString() == > 'SUCCESS' ? "blue.gif" : build.result.toString() == 'FAILURE' ? 'red.gif' : > 'yellow.gif' %>" /> > BUILD > ${build.result} > Build URL href="${rooturl}${build.url}">${rooturl}${build.url} > Project:${project.name} > Date of build:${it.timestampString} > Build duration:${build.durationString} > > > > Am i missing something, and what do i gain by switching to Groovy, unless > the sample scripts are bad examples. I was sort of Expecting the Groovy to > be more like we Code in Java. > > Thanks, > -Kamal. > > -- > *From:* Slide > *To:* "jenkinsci-users@googlegroups.com" > > *Sent:* Thursday, April 4, 2013 1:09 PM > *Subject:* Re: email-ext reporting Branch name > > Well, is there a reason you aren't doing this in Groovy? It would be > orders of magnitude easier than trying to do it in Jelly. > > > On Thu, Apr 4, 2013 at 9:39 AM, Kamal Ahmed wrote: > > Hi, > > I want to be able to use jelly script ( Apologize for not doing this in > Groovy ) to display the branch name on which the change
Re: email-ext reporting Branch name
i am having trouble understanding WHERE the tags ${build} , ${changeSet} are coming from, is there a way to get a list of what tags are available, and what methods can be used with them, like ${build.changeSet} without looking at the Jenkins and email-ext Source ? Also i just realized that the PATH which contains the "repo" name is ONLY available if someone checks in a changeset in subversion ( we are using subversion here ) but with NO changes, i would STILL like to see the repo name, is there a way to so that ? Thanks, -Kamal. > > From: Slide >To: "jenkinsci-users@googlegroups.com" >Sent: Thursday, April 4, 2013 3:14 PM >Subject: Re: email-ext reporting Branch name > > >The template files use the syntax of the SimpleTemplateEngine [1] from Groovy. >The email-ext.groovy is the default file that sets up the >SimpleTemplateEngine. I've been meaning to change this so that the script is >not needed, it just sets up some bindings for the template and I don't believe >anyone is changing that file. In the Groovy templates, you can use code blocks >to do operations and use the full Groovy language to do things intermixed with >the output generation. Think along the lines of PHP or JSP where you have code >embedded along with the HTML/rendering. The default templates have some >try/catch blocks and some if/else type blocks, you could also use the built-in >regex support in Groovy to do what you want with the regex. > > ><% >def yourStuff = yourString =~ /someregex/ >%> > > >blah blah ${yourStuff} > > > > > >1 - http://groovy.codehaus.org/Groovy+Templates > > > >On Thu, Apr 4, 2013 at 10:45 AM, Kamal Ahmed wrote: > >My only excuse is mostly my lack of groovy knowledge, and how it would work. >> >>1. I see the .groovy files and .template files, which one's should i use : >> >> ${SCRIPT,template="groovy-html.template"} >> >>or: >> >> ${SCRIPT,groovy="email-ext.groovy"} >> >> >> >>and if we look at jelly vs Groovy: >> >> >>Jelly ( html.jelly ) >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> BUILD ${build.result} >> Build URL>href="${rooturl}${build.url}">${rooturl}${build.url} >> Project:${project.name} >> Date of build:${it.timestampString} >> Build duration:${build.durationString} >> >> >> >> >> >>in Groovy : (groovy-html.template) >> >> >> >> >== 'FAILURE' ? 'red.gif' : 'yellow.gif' %>" /> >> BUILD >>${build.result} >> Build URL>href="${rooturl}${build.url}">${rooturl}${build.url} >> Project:${project.name} >> Date of build:${it.timestampString} >> Build duration:${build.durationString} >> >> >> >> >> >> >>Am i missing something, and what do i gain by switching to Groovy, unless the >>sample scripts are bad examples. I was sort of Expecting the Groovy to be >>more like we Code in Java. >> >> >>Thanks, >>-Kamal. >> >> >>> >>> From: Slide >>>To: "jenkinsci-users@googlegroups.com" >>>Sent: Thursday, April 4, 2013 1:09 PM >>>Subject: Re: email-ext reporting Branch name >>> >>> >>> >>>Well, is there a reason you aren't doing this in Groovy? It would be orders >>>of magnitude easier than trying to do it in Jelly. >>> >>> >>> >>>On Thu, Apr 4, 2013 at 9:39 AM, Kamal Ahmed wrote: >>> >>>Hi, >>>> >>>> >>>>I want to be able to use jelly script ( Apologize for not doing this in >>>>Groovy ) to display the branch name on which the changeset was submitted in >>>>subversion. >>>> >>>> >>>>Like , here is a snippet of my custom.jelly >>>> >>>> >>>>The p.path string is : >>>>/perlapp/trunk/cgi-bin/developer/smeview/reviewfiles/demo/cui_sample.csv >>>> >>>> >>>>so, i want to extract "perlapp" and "trunk" and display them in the email >>>>header. >>>> >>>> >>>> >>>> >>>> >>>> >>>> Build duration: >>>> ${build.d
Re: email-ext reporting Branch name
The template files use the syntax of the SimpleTemplateEngine [1] from Groovy. The email-ext.groovy is the default file that sets up the SimpleTemplateEngine. I've been meaning to change this so that the script is not needed, it just sets up some bindings for the template and I don't believe anyone is changing that file. In the Groovy templates, you can use code blocks to do operations and use the full Groovy language to do things intermixed with the output generation. Think along the lines of PHP or JSP where you have code embedded along with the HTML/rendering. The default templates have some try/catch blocks and some if/else type blocks, you could also use the built-in regex support in Groovy to do what you want with the regex. <% def yourStuff = yourString =~ /someregex/ %> blah blah ${yourStuff} 1 - http://groovy.codehaus.org/Groovy+Templates On Thu, Apr 4, 2013 at 10:45 AM, Kamal Ahmed wrote: > My only excuse is mostly my lack of groovy knowledge, and how it would > work. > > 1. I see the .groovy files and .template files, which one's should i use : > > ${SCRIPT,template="groovy-html.template"} > > or: > > ${SCRIPT,groovy="email-ext.groovy"} > > > and if we look at jelly vs Groovy: > > Jelly ( html.jelly ) > > > > > > > > > > > > > > > > > BUILD > ${build.result} > Build URL href="${rooturl}${build.url}">${rooturl}${build.url} > Project:${project.name} > Date of build:${it.timestampString} > Build duration:${build.durationString} > > > > in Groovy : (groovy-html.template) > > >SRC="${rooturl}static/e59dfe28/images/32x32/<%= build.result.toString() == > 'SUCCESS' ? "blue.gif" : build.result.toString() == 'FAILURE' ? 'red.gif' : > 'yellow.gif' %>" /> > BUILD > ${build.result} > Build URL href="${rooturl}${build.url}">${rooturl}${build.url} > Project:${project.name} > Date of build:${it.timestampString} > Build duration:${build.durationString} > > > > Am i missing something, and what do i gain by switching to Groovy, unless > the sample scripts are bad examples. I was sort of Expecting the Groovy to > be more like we Code in Java. > > Thanks, > -Kamal. > > -- > *From:* Slide > *To:* "jenkinsci-users@googlegroups.com" > > *Sent:* Thursday, April 4, 2013 1:09 PM > *Subject:* Re: email-ext reporting Branch name > > Well, is there a reason you aren't doing this in Groovy? It would be > orders of magnitude easier than trying to do it in Jelly. > > > On Thu, Apr 4, 2013 at 9:39 AM, Kamal Ahmed wrote: > > Hi, > > I want to be able to use jelly script ( Apologize for not doing this in > Groovy ) to display the branch name on which the changeset was submitted in > subversion. > > Like , here is a snippet of my custom.jelly > > The p.path string is : > /perlapp/trunk/cgi-bin/developer/smeview/reviewfiles/demo/cui_sample.csv > > so, i want to extract "perlapp" and "trunk" and display them in the email > header. > > > > Build duration: > ${build.durationString} > > > Branch: > I want to do a regex here on ${p.path} to extract the first > and second string > > > > > > > > > > > CHANGES > > > > > > > ${spc}Revision > ${cs.commitId?:cs.revision?:cs.changeNumber}by > ${aUser!=null?aUser.displayName:cs.author.displayName}: > (${cs.msgAnnotated}) > > > > ${spc}${p.editType.name<http://p.edittype.name/> > } > ${p.path} > -- > You received this message because you are subscribed to the Google Groups > "Jenkins Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to jenkinsci-users+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > > > > > > -- > Website: http://earl-of-code.com > -- > You received this message because you are subscribed to the Google Groups > "Jenkins Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to jenkinsci-users+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.c
Re: email-ext reporting Branch name
My only excuse is mostly my lack of groovy knowledge, and how it would work. 1. I see the .groovy files and .template files, which one's should i use : ${SCRIPT,template="groovy-html.template"} or: ${SCRIPT,groovy="email-ext.groovy"} and if we look at jelly vs Groovy: Jelly ( html.jelly ) BUILD ${build.result} Build URL${rooturl}${build.url} Project:${project.name} Date of build:${it.timestampString} Build duration:${build.durationString} in Groovy : (groovy-html.template) " /> BUILD ${build.result} Build URL${rooturl}${build.url} Project:${project.name} Date of build:${it.timestampString} Build duration:${build.durationString} Am i missing something, and what do i gain by switching to Groovy, unless the sample scripts are bad examples. I was sort of Expecting the Groovy to be more like we Code in Java. Thanks, -Kamal. > > From: Slide >To: "jenkinsci-users@googlegroups.com" >Sent: Thursday, April 4, 2013 1:09 PM >Subject: Re: email-ext reporting Branch name > > >Well, is there a reason you aren't doing this in Groovy? It would be orders of >magnitude easier than trying to do it in Jelly. > > > >On Thu, Apr 4, 2013 at 9:39 AM, Kamal Ahmed wrote: > >Hi, >> >> >>I want to be able to use jelly script ( Apologize for not doing this in >>Groovy ) to display the branch name on which the changeset was submitted in >>subversion. >> >> >>Like , here is a snippet of my custom.jelly >> >> >>The p.path string is : >>/perlapp/trunk/cgi-bin/developer/smeview/reviewfiles/demo/cui_sample.csv >> >> >>so, i want to extract "perlapp" and "trunk" and display them in the email >>header. >> >> >> >> >> >> >> Build duration: >> ${build.durationString} >> >> >> Branch: >> I want to do a regex here on ${p.path} to extract the first and >>second string >> >> >> >> >> >> >> >> >> >> >> CHANGES >> >> >> >> >> >> >> ${spc}Revision >> ${cs.commitId?:cs.revision?:cs.changeNumber}by >> ${aUser!=null?aUser.displayName:cs.author.displayName}: >> (${cs.msgAnnotated}) >> >> >> >> ${spc}${p.editType.name} >> ${p.path} >> -- >>You received this message because you are subscribed to the Google Groups >>"Jenkins Users" group. >>To unsubscribe from this group and stop receiving emails from it, send an >>email to jenkinsci-users+unsubscr...@googlegroups.com. >>For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > > > >-- >Website: http://earl-of-code.com -- >You received this message because you are subscribed to the Google Groups >"Jenkins Users" group. >To unsubscribe from this group and stop receiving emails from it, send an >email to jenkinsci-users+unsubscr...@googlegroups.com. >For more options, visit https://groups.google.com/groups/opt_out. > > > > > -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: email-ext reporting Branch name
Well, is there a reason you aren't doing this in Groovy? It would be orders of magnitude easier than trying to do it in Jelly. On Thu, Apr 4, 2013 at 9:39 AM, Kamal Ahmed wrote: > Hi, > > I want to be able to use jelly script ( Apologize for not doing this in > Groovy ) to display the branch name on which the changeset was submitted in > subversion. > > Like , here is a snippet of my custom.jelly > > The p.path string is : > /perlapp/trunk/cgi-bin/developer/smeview/reviewfiles/demo/cui_sample.csv > > so, i want to extract "perlapp" and "trunk" and display them in the email > header. > > > > Build duration: > ${build.durationString} > > > Branch: > I want to do a regex here on ${p.path} to extract the first > and second string > > > > > > > > > > > CHANGES > > > > > > > ${spc}Revision > ${cs.commitId?:cs.revision?:cs.changeNumber}by > ${aUser!=null?aUser.displayName:cs.author.displayName}: > (${cs.msgAnnotated}) > > > > ${spc}${p.editType.name} > ${p.path} > > -- > You received this message because you are subscribed to the Google Groups > "Jenkins Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to jenkinsci-users+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- Website: http://earl-of-code.com -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
email-ext reporting Branch name
Hi, I want to be able to use jelly script ( Apologize for not doing this in Groovy ) to display the branch name on which the changeset was submitted in subversion. Like , here is a snippet of my custom.jelly The p.path string is : /perlapp/trunk/cgi-bin/developer/smeview/reviewfiles/demo/cui_sample.csv so, i want to extract "perlapp" and "trunk" and display them in the email header. Build duration: ${build.durationString} Branch: I want to do a regex here on ${p.path} to extract the first and second string CHANGES ${spc}Revision ${cs.commitId?:cs.revision?:cs.changeNumber}by ${aUser!=null?aUser.displayName:cs.author.displayName}: (${cs.msgAnnotated}) ${spc}${p.editType.name} ${p.path} -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.