How can I get the SVN log entry in Jenkins when sending email
Asked Answered
K

1

2

I'm trying to create an automated build at work using Jenkins. We're using SVN for version control. When a build is successful I would like to send an email to my team saying... Person X has committed the following changes.

How can I include the committers name and the last SVN log entry in the body of the email? I'm using the Jenking email-ext plugin.

Thanks!

Katar answered 8/5, 2013 at 15:41 Comment(0)
K
7

Subject line:

To display the committer(s) of the last build, you can put the following into the subject line anywhere you want. Do note that if multiple people have committed since the last build, multiple names will be shown, hence the (space) in "%a ".

${CHANGES, format="%a "}has/have committed the following changes

Or to display a list of culprits that broke the build

Build broken by ${CHANGES_SINCE_LAST_SUCCESS, reverse=true, format="%c", changesFormat="%a "}

Unfortunately, if a culprit's name appears several times in commit messages, it will appear several times in the subject too.

SVN log in the email

To get the SVN log into the email, I use the following:

${CHANGES_SINCE_LAST_SUCCESS, reverse=true, format="<b>Changes for Build #%n</b><br>%c<br>", changesFormat="<br>[<a href='${JENKINS_URL}/user/%a/builds'>%a</a>] - (%r) %p<br> %m<br>"}

This was all pulled together from the Content Token Reference on-page help with lots of trial and error. Scroll to the bottom of your email-ext configuration, and click the ? icon in-line with Content Token Reference text (it may take a while to load)

Produces output similar to:


Changes for Build #123

[commiter_name] - (1234567) /svn/path/to/changed.files
Commit message here


Kipper answered 19/3, 2014 at 14:9 Comment(1)
Edited answer to include another duplicate questionKipper

© 2022 - 2024 — McMap. All rights reserved.