Using variables within the Jenkins email subject lines ?

9,284 views
Skip to first unread message

Tom80112

unread,
Sep 25, 2012, 5:31:23 PM9/25/12
to jenkins...@googlegroups.com
I would like to use variables within Jenkins email subject lines.

I am using the "editable email notification" plugin.

Instead of having a set-in-stone email subject line, I would like define
the subject line using a variable that I define based upon the job's
execution.

Anyone have any ideas?





--
View this message in context: http://jenkins.361315.n4.nabble.com/Using-variables-within-the-Jenkins-email-subject-lines-tp4641373.html
Sent from the Jenkins users mailing list archive at Nabble.com.

Youri

unread,
Sep 26, 2012, 6:37:20 AM9/26/12
to jenkins...@googlegroups.com
I'm using this subject: Projec ${ENV,var="releaseVersion"} has been released
And releaseVersion is variable typed in by the user launching the job, now i'm not sure if you can actually create a variable during the job execution (from a shell script) and use it.

giuliano

unread,
Sep 26, 2012, 1:50:57 PM9/26/12
to jenkins...@googlegroups.com
You can use vars generated with a shell script. What we do is write them to a file, then use the "Inject environment variables" plugin.

Slide

unread,
Sep 26, 2012, 1:56:28 PM9/26/12
to jenkins...@googlegroups.com
email-ext or the normal emailer?
--
Website: http://earl-of-code.com

Tom80112

unread,
Sep 26, 2012, 10:24:58 PM9/26/12
to jenkins...@googlegroups.com
I loaded the EnvInject plugin and tried that before posting here.

Inside the shell script section, I set a variable called "subject" to to a
different
text string depending on outcomes within the shell script section.

I then did a printf "subject=$subject\n" >tmp.env

I then specified tmp.env on the first line of the EnvInject. This is all I
did for the EnvInject block. Did I need to fill in anything else?

I then used "editable email" and placed $subject in the subject line.
The email came in with a subject line of: $subject (not evaluated)





--
View this message in context: http://jenkins.361315.n4.nabble.com/Using-variables-within-the-Jenkins-email-subject-lines-tp4641373p4641525.html

Slide

unread,
Sep 27, 2012, 1:20:49 AM9/27/12
to jenkins...@googlegroups.com
Try ${ENV, var="subject"}
--
Website: http://earl-of-code.com

lalit kumar

unread,
Nov 1, 2013, 1:37:01 PM11/1/13
to jenkins...@googlegroups.com

lkumarblogs

unread,
Nov 1, 2013, 1:52:18 PM11/1/13
to jenkins...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages