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] <https://www.bodycad.com/> 
> Jerome Godbout
> Software Developer
> 2035 rue du Haut-Bord, Québec, QC, Canada. G1N 4R7
> T:  +1 418 527-1388
> E: jer...@bodycad.com <javascript:>
> 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 <piconi...@gmail.com 
> <javascript:>> 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
>>>>
>>>>
>>>> <!-- CHANGE SET -->
>>>> <% changeSet = build.changeSet
>>>> if (changeSet != null) {
>>>> hadChanges = false %>
>>>> <h2>Changes</h2>
>>>> <ul>
>>>> <% changeSet.each { cs ->
>>>> hadChanges = true
>>>> aUser = cs.author %>
>>>> <li>Commit <b>${cs.revision}</b> by <b><%= aUser != null ? 
>>>> aUser.displayName :      it.author.displayName %>:</b> (${cs.msg})
>>>> <ul>
>>>> <% cs.affectedFiles.each { %>
>>>> <li class="change-${it.editType.name}"><b>${it.editType.name}</b>: 
>>>> ${it.path}                              </li> <%  } %> </ul>   </li> <%  }
>>>>
>>>>  if (!hadChanges) { %>  
>>>>   <li>No Changes !!</li>
>>>>  <%  } %>   </ul> <% } %>
>>>>
>>>>
>>>> *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 a topic in the 
>> Google Groups "Jenkins Users" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/jenkinsci-users/mIzYWDmMKGM/unsubscribe
>> .
>> To unsubscribe from this group and all its topics, send an email to 
>> jenkinsci-use...@googlegroups.com <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jenkinsci-users/a82ee9f8-e59e-4e11-9a77-0d57bbb1e352%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/a82ee9f8-e59e-4e11-9a77-0d57bbb1e352%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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/2110bdb6-1a41-4c23-b21b-a23aa1560107%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to