Are jelly templates supported in email-ext with pipeline

2.192 Aufrufe
Direkt zur ersten ungelesenen Nachricht

Rinaldo DiGiorgio

ungelesen,
09.02.2016, 12:32:1909.02.16
an Jenkins Users
I am able to use email-ext with pipeline to send emails.  I am trying to use jelly templates. I do not see an option for the template processor in the following. I tried adding SCRIPT to the body.


    emailext attachLog: true, body: ' ${SCRIPT, template="html/test.groovy"}', subject: 'Test of email', to: 'somea...@somedomain.com'






Slide

ungelesen,
16.04.2016, 14:16:3516.04.16
an Jenkins Users
No, this is not currently supported. Token macro, which is the basis for the SCRIPT token doesn't currently support the type of object that pipeline uses.

On Tue, Feb 9, 2016 at 10:32 AM Rinaldo DiGiorgio <digital...@gmail.com> wrote:
I am able to use email-ext with pipeline to send emails.  I am trying to use jelly templates. I do not see an option for the template processor in the following. I tried adding SCRIPT to the body.


    emailext attachLog: true, body: ' ${SCRIPT, template="html/test.groovy"}', subject: 'Test of email', to: 'somea...@somedomain.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-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/f7ed76fc-7c0d-4b5d-b582-5e39d468809d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mark Bidewell

ungelesen,
21.04.2016, 09:30:3221.04.16
an Jenkins Users
Is support planed for a future release?

Slide

ungelesen,
21.04.2016, 10:21:5221.04.16
an Jenkins Users

The biggest hurdle at this point is that email-ext uses token macro for token replacement and token macro is built around AbstractBuild, which pipeline does not use. I am looking into adding the capability to token macro, and thus email-ext. It's something I am actively working on.


András Gaál

ungelesen,
13.10.2016, 11:08:5213.10.16
an Jenkins Users
Hi, any updates on this?

Regards,
Andrew

dor...@tikalk.com

ungelesen,
23.05.2017, 08:32:1523.05.17
an Jenkins Users
Any update about that?

I found it really missing..... can not use templates / can not use other token macros such CHANGES...
 
I think that the whole JenkinsFile concept is great but still not mature for real use...

Slide

ungelesen,
23.05.2017, 09:11:1223.05.17
an Jenkins Users
Many macros should work fine by putting them in the body or subject fields of the pipeline. SCRIPT specifically uses some things from AbstractBuild, which a pipeline job is not, so that is why SCRIPT can't be used. It would need to be updated to support pipeline jobs as well. 

Doron Shai

ungelesen,
23.05.2017, 09:12:5623.05.17
an jenkins...@googlegroups.com
Do you know how i can use the CHANGES script token ? It does not see to be possible according to what I tried....

To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.

--
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/turlQIsPgCc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVd12VDOobAnY6HmJybEWkRps8meY1ODndWxU3nbPeuj_Q%40mail.gmail.com.

Slide

ungelesen,
23.05.2017, 09:56:2023.05.17
an jenkins...@googlegroups.com
What did you try, and what was the result?

--
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/turlQIsPgCc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-use...@googlegroups.com.

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-use...@googlegroups.com.

jer...@bodycad.com

ungelesen,
23.05.2017, 13:18:4023.05.17
an Jenkins Users
Into pipeline they are working to certain extent, but you have to take special care when declaring the usage of the body (it does not support windows \ into the path, convert to unix path type):

emailext body: '${JELLY_SCRIPT,template="/path/to/templatefile.template"}', subject: 'subject', to: 'myt...@test.com', replyTo: 'jen...@test.com', mimeType: 'text/html';

I for one also made a replacement function to replace the variables into the template file and write it again with the replacement.
  1. read the template with special string to be replaced
  2. replace some variables into the string
  3. write the template into the tempo folder of the master (since a few release it no more check on the slave with absolute path).
  4. Send the tempo filled copy.
It's the best way I found to do this with a few function I load every project. I give it a dictionary to replace all values into the template. I also have something that convert windows path to Unix path style and generate the whole body entry with a simple path. So I don't bother with what is available or not into the Jelly context/parsing anymore. It give me more freedom and I known what to expect every time, I also have some style replacement based on the project (devel, official, etc) that I can now inject based on the project/branch/result...

Another fun part, is to combine multiple template part together based on the build results ;-)

Seb M

ungelesen,
18.06.2017, 01:44:0018.06.17
an Jenkins Users
To pick this up again, i also tried to get this to work and ran into some issues:
 emailext (
      subject: "subject",
      body: """<p>STARTED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]':</p>
 <div style="padding-left: 30px; padding-bottom: 15px;">
   ${CHANGES, showPaths=true}

  </div>
    <p>Check console output at "<a href="${env.BUILD_URL}">${env.JOB_NAME} [${env.BUILD_NUMBER}]</a>"</p>""",
      recipientProviders: [[$class: 'CulpritsRecipientProvider']]
    )

would just give me a "Unexpected Token" Groovy Error. Using:
 emailext (
      subject: "subject",
      body: """<p>STARTED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]':</p>
 <div style="padding-left: 30px; padding-bottom: 15px;">
   ${CHANGES(showPaths: true)}

  </div>
    <p>Check console output at "<a href="${env.BUILD_URL}">${env.JOB_NAME} [${env.BUILD_NUMBER}]</a>"</p>""",
      recipientProviders: [[$class: 'CulpritsRecipientProvider']]
    )

i get:
java.lang.NoSuchMethodError: No such DSL method 'CHANGES' found among steps 

So this does not really seam to work? Or is there some error in my syntax?
Regards,
Seb

Daniel Beck

ungelesen,
19.06.2017, 07:15:4019.06.17
an jenkins...@googlegroups.com

> On 18. Jun 2017, at 07:43, Seb M <sebastian...@gmail.com> wrote:
>
> So this does not really seam to work? Or is there some error in my syntax?

Tri triple-single-quoted strings or escaping the $ -- right now, it's looking for a DSL variable "CHANGES" as it evaluates the ${CHANGES, …} in the DSL.

Allen antworten
Antwort an Autor
Weiterleiten
0 neue Nachrichten