0

How do I get the hostname into an email-ext subject line in jenkins?

I.e. I want something like:

`hostname` $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!
melpomene
  • 84,125
  • 8
  • 85
  • 148
K Richard Pixley
  • 617
  • 1
  • 6
  • 10
  • ["To see a list of all available email tokens and what they display, you can click the "?" (question mark) associated with the Content Token Reference at the top bottom of the email-ext section on the project configuration screen."](https://wiki.jenkins-ci.org/display/JENKINS/Email-ext+plugin#Email-extplugin-Emailtokens) Does anything look relevant there? – melpomene Jan 05 '17 at 22:39
  • http://stackoverflow.com/q/10832486/1848654 mentions `${ENV,var="variable_name"}`. Is `${ENV,var="HOSTNAME"}` set? – melpomene Jan 05 '17 at 22:41
  • No HOSTNAME in environment. The hostname I want comes from executing "hostname -s". – K Richard Pixley Mar 14 '17 at 18:29
  • Nothing relevant in existing email tokens. – K Richard Pixley Mar 14 '17 at 18:29

1 Answers1

3

Here is one solution :)

enter image description here

enter image description here

Tested in my Jenkins 2 instance, it's working.

Bruno Lavit
  • 10,184
  • 2
  • 32
  • 38