Inserting a Jelly template into a step

18 views
Skip to first unread message

Victor Sudakov

unread,
Sep 28, 2021, 3:21:26 AM9/28/21
to jenkins...@googlegroups.com
Hello Colleagues,

Sorry for being dumb. I'm currently using the following simple step:

post {
failure {
emailext body: 'Check console output at $BUILD_URL to view the results', subject: '....
}
}

If I want to replace this simple oneliner with a Jelly template, where should
I insert the ${JELLY_SCRIPT,template="text"} variable? I've tried the following:

emailext body: '${JELLY_SCRIPT,template="text"}', subject: '....

But it resulted in a very laconic mail body:

======================================================
GENERAL INFO
BUILD FAILURE
Build URL: https://jenkins.....
Project: ....
Date of build: Tue, 28 Sep 2021 05:08:28 +0000
Build duration: 1 min 36 sec and counting
======================================================

Which is not at all like the lush message on the
email-ext-plugin docs screenshots.

What am I doing wrong?

Jenkins 2.303.1, Email Extension Plugin 2.83

--
Victor Sudakov VAS4-RIPE
http://vas.tomsk.ru/
2:5005/49@fidonet

Björn Pedersen

unread,
Sep 28, 2021, 6:19:31 AM9/28/21
to Jenkins Users
Victor Sudakov schrieb am Dienstag, 28. September 2021 um 09:21:26 UTC+2:
Hello Colleagues,

Sorry for being dumb. I'm currently using the following simple step:

post {
failure {
emailext body: 'Check console output at $BUILD_URL to view the results', subject: '....
}
}

If I want to replace this simple oneliner with a Jelly template, where should
I insert the ${JELLY_SCRIPT,template="text"} variable? I've tried the following:

emailext body: '${JELLY_SCRIPT,template="text"}', subject: '....


did you mena template="html" ?
 
But it resulted in a very laconic mail body:


Seems like that is correct for the text template. Many things in the output will only be there if you also have the correct 
steps in your pipeline ( cobertura coverage, junit results). And as some of those are outdated you probably need to
 write your own template to use the newer replacement versions.

Björn

Victor Sudakov

unread,
Sep 28, 2021, 9:59:43 AM9/28/21
to 'Björn Pedersen' via Jenkins Users
'Björn Pedersen' via Jenkins Users wrote:
> >
> > Sorry for being dumb. I'm currently using the following simple step:
> >
> > post {
> > failure {
> > emailext body: 'Check console output at $BUILD_URL to view the results',
> > subject: '....
> > }
> > }
> >
> > If I want to replace this simple oneliner with a Jelly template, where
> > should
> > I insert the ${JELLY_SCRIPT,template="text"} variable? I've tried the
> > following:
> >
> > emailext body: '${JELLY_SCRIPT,template="text"}', subject: '....
> >
> >
> did you mena template="html" ?

The presence of a text/plain part is required. If template="html" can
provide both a text/plain and a text/html part (like multipart mails
from CircleCI), then yes. Otherwise I'll have to use template="text".

>
>
> > But it resulted in a very laconic mail body:
> >
> >
> Seems like that is correct for the text template.

OK, thank you for confirmation.

> Many things in the output
> will only be there if you also have the correct
> steps in your pipeline ( cobertura coverage, junit results).

Sounds kind of excessive. I just wanted to see some useful things in
the mail body, like the commit messages, committer name etc (this info
is already available in the web interface for every build). Maybe the
tail of the build log too.


> And as some of
> those are outdated you probably need to
> write your own template to use the newer replacement versions.

Maybe you know of a repo of mail templates somewhere?
Reply all
Reply to author
Forward
0 new messages