Thursday, October 31, 2013

Use environment variable in Jenkins editable email notification subject.

Today, i am gonna describe a solution to send the Jenkins email notification with editable subject instead of default subject each time depending upon the current environment variable.
                                                                                                 This can help you in the case when you have a Jenkins build,which builds with user provided environment variable according to requirement and then you may also want to get the email notification after completion with the subject having environment variable used to trigger build.

I assume you have created a Jenkins job as per your project requirements :

Step 1 : Configure the build parameters [ User defined environment variable ]
For Example

Step 2 : Add Editable email notification as after build action  :

Step 3 : Update the Default subject as given in screenshot to include the user given environment variables in email notification.
For Example
If you have user defined parameter 'testsite' with value '', then to send the parameter value in email notification update the default subject field as :
${ENV, var="testsite"}

Step 4 : Save the job configuration and its ready to go :)

AWS Certified Solutions Architect Associate - AWS Introduction - Questions

All the Best !!! Show Result !! Try Again !! ×