Is there any way to import the changelog that is generated by Jenkins to the subject of an email (either through the default email, or the email-ext plugin)?
I am new to Jenkins configuration, so I apologize if this is a simple issue, but I was not able to find anything on the email-ext documentation.
Added script under *Jenkins -> Manage Jenkins -> Editable Email Notification Templates-> Add New Template* and then under "Default Content" section, we added default groovy scripts (for example: groovy-html. template - Copy paste content). Save. Now under project job, under Post-build section we selected same template.
I configured my Email-ext plug-in to use the CHANGES Token (official documentation here):
Changes: ${CHANGES, showPaths=true, format="%a: %r %p \n--\"%m\"", pathFormat="\n\t- %p"}
That prints the following in my build notifications:
Changes: Username: 123 - Project/Filename1.m - Project/Filename2.m -- "My log message"
For HTML messages, I placed the same code within a div and added formatting:
<div style="padding-left: 30px; padding-bottom: 15px;"> ${CHANGES, showPaths=true, format="<div><b>%a</b>: %r %p </div><div style=\"padding-left:30px;\"> — “<em>%m</em>”</div>", pathFormat="</div><div style=\"padding-left:30px;\">%p"} </div>
Here's a sample screenshot of how it looks in the e-mails sent out by Jenkins now (this particular commit came from Subversion, but it works exactly the same for Git and other version control systems):
From original documentation: 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 bottom of the email-ext section on the project configuration screen.
Here is result:
${CHANGES} Displays the changes since the last build. showDependencies If true, changes to projects this build depends on are shown. Defaults to false showPaths If true, the paths, modifued by a commit are shown. Defaults to false format For each commit listed, a string containing %X, where %x is one of: %a author %d date %m message %p path %r revision Not all revision systems support %d and %r. If specified showPaths argument is ignored. Defaults to "[%a] %m\\n" pathFormat A string containing %p to indicate how to print paths. Defaults to "\\t%p\\n"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With