Re: emailext jelly template access changetSet

2018-01-14 Thread Puneet Notani
https://gist.github.com/tsengeagle/1bab2c2a36433795a68d1623c2e975b9

On Friday, 26 May 2017 00:17:44 UTC+5:30, Jérôme Godbout wrote:
>
> I haven't found the way to make it work into Jelly and did not found time 
> to test Groovy template either sadly :-(
>
> I made many changes manually by a replace function into a copy of the 
> template before sending the template so I probably will be able to replace 
> the changelog with the following pipeline script:
>
> def changeLogSets = currentBuild.changeSets
> for (int i = 0; i < changeLogSets.size(); i++) { ... replace into the 
> template file text for each line into html format string...}
>
> Haven't test it yet, but my I already read  file out of my template and 
> replace some variable and write back a temporary template that I send. 
>
> // Replace literal ${VAR} by the map[VAR] entry
> def replaceMapIntoStr(str, replace_map)
> {
> def rv = str;
> for(item in replace_map)
> {
> rv = rv.replace('${' + item.key + '}', item.value);
> }
> return rv;
> }
>
> As matter of fact I assemble multiple template part based on the current 
> build result and steps done.
>
> [image: bodycad]  
> Jerome Godbout
> Software Developer
> 2035 rue du Haut-Bord, Québec, QC, Canada. G1N 4R7
> T:  +1 418 527-1388
> E: jer...@bodycad.com 
> www.bodycad.com
>
> The contents of this email message and any attachments are intended solely 
> for the addressee(s) and may contain confidential and/or privileged 
> information and may be legally protected from disclosure. If you are not 
> the intended recipient of this message or their agent, or if this message 
> has been addressed to you in error, please immediately alert the sender by 
> reply email and then delete this message and any attachments. If you are 
> not the intended recipient, you are hereby notified that any use, 
> dissemination, copying, or storage of this message or its attachments is 
> strictly prohibited. 
>
> Le contenu de ce message et les pièces jointes sont destinés uniquement 
> pour le(s) destinataire(s) et peuvent contenir des informations 
> confidentielles et / ou privilégiées qui peuvent être protégées légalement 
> contre toute divulgation. Si vous n'êtes pas le destinataire de ce message 
> ou son agent, ou si ce message vous a été adressé par erreur, s’il vous 
> plaît avertir immédiatement l'expéditeur par courriel de réponse, puis 
> supprimer ce message et les pièces jointes. Si vous n'êtes pas le 
> destinataire prévu, vous êtes par la présente informé que toute 
> utilisation, diffusion, copie, ou stockage de ce message ou de ses pièces 
> jointes est strictement interdit.
>
> On Thu, May 25, 2017 at 2:12 PM, Manny DaSilva  > wrote:
>
>> I'm in the same situation. Have you found a solution using Jelly? I tried 
>> currentBuild.changeSets as described in the doc but it doesn't work in the 
>> Jelly template.
>>
>>
>> On Wednesday, October 19, 2016 at 12:09:22 PM UTC-4, jer...@bodycad.com 
>> wrote:
>>>
>>> I haven't tested this yet, but does this groovy template work into a 
>>> pipeline? we used to have a groovy template like this before that did 
>>> exactly what you propose. Since I wasn't sure how to select the groovy 
>>> script (now I do, thanks to someone on this forum) and found how to use a 
>>> jelly template before I converted everything to Jelly. The Jelly equivalent 
>>> doesn't seem to work. I wonder if this is du to Jelly templating or the 
>>> pipeline??? If this is the jelly, I will convert back to Groovy, else I 
>>> will stick to Jelly, the template is cleaner IMO.
>>>
>>> Thanks,
>>> Jerome
>>>
>>> I will try this and come back on this
>>>
>>> On Wednesday, October 19, 2016 at 5:56:51 AM UTC-4, touseef wrote:

 May be this code might helped u as i had similar requirement but i 
 implemented it in groovy script


 
 <% changeSet = build.changeSet
 if (changeSet != null) {
 hadChanges = false %>
 Changes
 
 <% changeSet.each { cs ->
 hadChanges = true
 aUser = cs.author %>
 Commit ${cs.revision} by <%= aUser != null ? 
 aUser.displayName :  it.author.displayName %>: (${cs.msg})
 
 <% cs.affectedFiles.each { %>
 ${it.editType.name}: 
 ${it.path}   <%  } %> <%  }

  if (!hadChanges) { %>  
   No Changes !!
  <%  } %><% } %>


 *And regarding the count u cant use this*

 *def size= build.changeSet.items.length*


 On Monday, 17 October 2016 20:36:33 UTC+5:30, jer...@bodycad.com wrote:
>
> Hi,
> I have use the Jelly template to re enable most of our email content, 
> except 2 things I still cannot do, the revision change set and the 
> warnings 
> counts (the later is not too bad, we are moving to warnings as errors 
> anyway).
>
> Any body have a way to access the scm changeSet into the pipeline 
> emailext template?
>
> I 

Re: emailext jelly template access changetSet

2017-05-25 Thread Jérôme Godbout
I haven't found the way to make it work into Jelly and did not found time
to test Groovy template either sadly :-(

I made many changes manually by a replace function into a copy of the
template before sending the template so I probably will be able to replace
the changelog with the following pipeline script:

def changeLogSets = currentBuild.changeSets
for (int i = 0; i < changeLogSets.size(); i++) { ... replace into the
template file text for each line into html format string...}

Haven't test it yet, but my I already read  file out of my template and
replace some variable and write back a temporary template that I send.

// Replace literal ${VAR} by the map[VAR] entry
def replaceMapIntoStr(str, replace_map)
{
def rv = str;
for(item in replace_map)
{
rv = rv.replace('${' + item.key + '}', item.value);
}
return rv;
}

As matter of fact I assemble multiple template part based on the current
build result and steps done.

[image: bodycad] 
Jerome Godbout
Software Developer
2035 rue du Haut-Bord, Québec, QC, Canada. G1N 4R7
T:  +1 418 527-1388
E: jer...@bodycad.com
www.bodycad.com

The contents of this email message and any attachments are intended solely
for the addressee(s) and may contain confidential and/or privileged
information and may be legally protected from disclosure. If you are not
the intended recipient of this message or their agent, or if this message
has been addressed to you in error, please immediately alert the sender by
reply email and then delete this message and any attachments. If you are
not the intended recipient, you are hereby notified that any use,
dissemination, copying, or storage of this message or its attachments is
strictly prohibited.

Le contenu de ce message et les pièces jointes sont destinés uniquement
pour le(s) destinataire(s) et peuvent contenir des informations
confidentielles et / ou privilégiées qui peuvent être protégées légalement
contre toute divulgation. Si vous n'êtes pas le destinataire de ce message
ou son agent, ou si ce message vous a été adressé par erreur, s’il vous
plaît avertir immédiatement l'expéditeur par courriel de réponse, puis
supprimer ce message et les pièces jointes. Si vous n'êtes pas le
destinataire prévu, vous êtes par la présente informé que toute
utilisation, diffusion, copie, ou stockage de ce message ou de ses pièces
jointes est strictement interdit.

On Thu, May 25, 2017 at 2:12 PM, Manny DaSilva 
wrote:

> I'm in the same situation. Have you found a solution using Jelly? I tried
> currentBuild.changeSets as described in the doc but it doesn't work in the
> Jelly template.
>
>
> On Wednesday, October 19, 2016 at 12:09:22 PM UTC-4, jer...@bodycad.com
> wrote:
>>
>> I haven't tested this yet, but does this groovy template work into a
>> pipeline? we used to have a groovy template like this before that did
>> exactly what you propose. Since I wasn't sure how to select the groovy
>> script (now I do, thanks to someone on this forum) and found how to use a
>> jelly template before I converted everything to Jelly. The Jelly equivalent
>> doesn't seem to work. I wonder if this is du to Jelly templating or the
>> pipeline??? If this is the jelly, I will convert back to Groovy, else I
>> will stick to Jelly, the template is cleaner IMO.
>>
>> Thanks,
>> Jerome
>>
>> I will try this and come back on this
>>
>> On Wednesday, October 19, 2016 at 5:56:51 AM UTC-4, touseef wrote:
>>>
>>> May be this code might helped u as i had similar requirement but i 
>>> implemented it in groovy script
>>>
>>>
>>> 
>>> <% changeSet = build.changeSet
>>> if (changeSet != null) {
>>> hadChanges = false %>
>>> Changes
>>> 
>>> <% changeSet.each { cs ->
>>> hadChanges = true
>>> aUser = cs.author %>
>>> Commit ${cs.revision} by <%= aUser != null ? 
>>> aUser.displayName :  it.author.displayName %>: (${cs.msg})
>>> 
>>> <% cs.affectedFiles.each { %>
>>> ${it.editType.name}: 
>>> ${it.path}   <%  } %> <%  }
>>>
>>>  if (!hadChanges) { %>
>>>   No Changes !!
>>>  <%  } %><% } %>
>>>
>>>
>>> *And regarding the count u cant use this*
>>>
>>> *def size= build.changeSet.items.length*
>>>
>>>
>>> On Monday, 17 October 2016 20:36:33 UTC+5:30, jer...@bodycad.com wrote:

 Hi,
 I have use the Jelly template to re enable most of our email content,
 except 2 things I still cannot do, the revision change set and the warnings
 counts (the later is not too bad, we are moving to warnings as errors
 anyway).

 Any body have a way to access the scm changeSet into the pipeline
 emailext template?

 I tried without any luck:

- ${build.changeSet}
- ${build.changeSets}
- ${currentBuild.changeSets}
- ${manager.build.changeSets}
- ${manager.build.changeSet}

 the console log are accessible with ${build.getLog()}
 the artifacts are with ${build.artifacts}

 The warning were:
 

Re: emailext jelly template access changetSet

2016-10-19 Thread jerome
I haven't tested this yet, but does this groovy template work into a 
pipeline? we used to have a groovy template like this before that did 
exactly what you propose. Since I wasn't sure how to select the groovy 
script (now I do, thanks to someone on this forum) and found how to use a 
jelly template before I converted everything to Jelly. The Jelly equivalent 
doesn't seem to work. I wonder if this is du to Jelly templating or the 
pipeline??? If this is the jelly, I will convert back to Groovy, else I 
will stick to Jelly, the template is cleaner IMO.

Thanks,
Jerome

I will try this and come back on this

On Wednesday, October 19, 2016 at 5:56:51 AM UTC-4, touseef wrote:
>
> May be this code might helped u as i had similar requirement but i 
> implemented it in groovy script
>
>
> 
> <% changeSet = build.changeSet
> if (changeSet != null) {
> hadChanges = false %>
> Changes
> 
> <% changeSet.each { cs ->
> hadChanges = true
> aUser = cs.author %>
> Commit ${cs.revision} by <%= aUser != null ? aUser.displayName 
> :  it.author.displayName %>: (${cs.msg})
> 
> <% cs.affectedFiles.each { %>
> ${it.editType.name}: ${it.path} 
>   <%  } %> <%  }
>
>  if (!hadChanges) { %>  
>   No Changes !!
>  <%  } %><% } %>
>
>
> *And regarding the count u cant use this*
>
> *def size= build.changeSet.items.length*
>
>
> On Monday, 17 October 2016 20:36:33 UTC+5:30, jer...@bodycad.com wrote:
>>
>> Hi,
>> I have use the Jelly template to re enable most of our email content, 
>> except 2 things I still cannot do, the revision change set and the warnings 
>> counts (the later is not too bad, we are moving to warnings as errors 
>> anyway).
>>
>> Any body have a way to access the scm changeSet into the pipeline 
>> emailext template?
>>
>> I tried without any luck:
>>
>>- ${build.changeSet}
>>- ${build.changeSets}
>>- ${currentBuild.changeSets}
>>- ${manager.build.changeSets}
>>- ${manager.build.changeSet}
>>
>> the console log are accessible with ${build.getLog()}
>> the artifacts are with ${build.artifacts}
>>
>> The warning were:
>> ${WARNINGS_RESULT()}
>> ${WARNINGS_COUNT()}
>> ${WARNINGS_NEW()}
>> ${WARNINGS_FIXED()}
>>
>> but now if used they generate a jelly parsing error.
>>
>> if any body have any tips or info on this I would be glad,
>> Thanks
>> Jerome
>>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/c1095c48-4a2c-4ad3-9ad0-960148d0cac0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: emailext jelly template access changetSet

2016-10-19 Thread touseef


May be this code might helped u as i had similar requirement but i implemented 
it in groovy script



<% changeSet = build.changeSet
if (changeSet != null) {
hadChanges = false %>
Changes

<% changeSet.each { cs ->
hadChanges = true
aUser = cs.author %>
Commit ${cs.revision} by <%= aUser != null ? aUser.displayName :  
it.author.displayName %>: (${cs.msg})

<% cs.affectedFiles.each { %>
${it.editType.name}: ${it.path}   
<%  } %> <%  }

 if (!hadChanges) { %>  
  No Changes !!
 <%  } %><% } %>


*And regarding the count u cant use this*

*def size= build.changeSet.items.length*


On Monday, 17 October 2016 20:36:33 UTC+5:30, jer...@bodycad.com wrote:
>
> Hi,
> I have use the Jelly template to re enable most of our email content, 
> except 2 things I still cannot do, the revision change set and the warnings 
> counts (the later is not too bad, we are moving to warnings as errors 
> anyway).
>
> Any body have a way to access the scm changeSet into the pipeline emailext 
> template?
>
> I tried without any luck:
>
>- ${build.changeSet}
>- ${build.changeSets}
>- ${currentBuild.changeSets}
>- ${manager.build.changeSets}
>- ${manager.build.changeSet}
>
> the console log are accessible with ${build.getLog()}
> the artifacts are with ${build.artifacts}
>
> The warning were:
> ${WARNINGS_RESULT()}
> ${WARNINGS_COUNT()}
> ${WARNINGS_NEW()}
> ${WARNINGS_FIXED()}
>
> but now if used they generate a jelly parsing error.
>
> if any body have any tips or info on this I would be glad,
> Thanks
> Jerome
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/565f9013-59e1-4cea-b75f-57c712b130d1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


emailext jelly template access changetSet

2016-10-17 Thread jerome
Hi,
I have use the Jelly template to re enable most of our email content, 
except 2 things I still cannot do, the revision change set and the warnings 
counts (the later is not too bad, we are moving to warnings as errors 
anyway).

Any body have a way to access the scm changeSet into the pipeline emailext 
template?

I tried without any luck:

   - ${build.changeSet}
   - ${build.changeSets}
   - ${currentBuild.changeSets}
   - ${manager.build.changeSets}
   - ${manager.build.changeSet}
   
the console log are accessible with ${build.getLog()}
the artifacts are with ${build.artifacts}

The warning were:
${WARNINGS_RESULT()}
${WARNINGS_COUNT()}
${WARNINGS_NEW()}
${WARNINGS_FIXED()}

but now if used they generate a jelly parsing error.

if any body have any tips or info on this I would be glad,
Thanks
Jerome

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/05c11b76-e9a9-4fe7-ab19-94410a2d0708%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.