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.
From version 2.0 and later of Git Changelog Plugin, you can get the changelog as a string in a pipeline. And then just use that variable in the mail.
I configured my Email-ext plug-in to use the CHANGES Token (official documentation here):
That prints the following in my build notifications:
For HTML messages, I placed the same code within a div and added formatting:
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):
Not in the subject of an email though you can send the change log to the recipient as an attachment in a mail using Git Changelog Plugin as post build action in
Jenkins
Job. SelectCreate a file
checkbox, give a name to a file (CHANGELOG.md
for me), as in below image:Make sure you have configured Source Code Management as GIT in Jenkins JOB.
Then create Editable Email Notification post build action and copy the name of the git change log file as the value of
Attachments
, as in below image: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: