Jan 17, 2007

Adding the Subversion Revision to the CruiseControl Build Summary

At work we use Subversion for source code version control and the excellent CruiseControl.NET (ccnet) for continuous integration.

One of the things we do is version all of the assemblyinfo files with the subversion revision number. This way all the files we release have a build number that can be traced directly back to the subversion revision number so we can see what changes were made if there are any problems.

Unfortunately when looking through the ccnet webdashboard you don't get shown the SVN revision in the summary. This is because ccnet is designed to work with a multitude of source repositories and not just Subversion. Fortunately adding the revision to the summary page is a really simple task. Here's what it looks like:

buildlog

In order to get this showing you need to edit the .xsl file used to display the summary page.

1. Open {$CC Installation Root}\webdashboard\xsl\header.xsl
2. Go to the bottom of the file and locate the "Last Log Entry" section. It should look like this.

<tr>
<td class="header-label" valign="top"><nobr>Last log entry:</nobr></td>
<td class="header-data"><pre><xsl:value-of select="comment"/></pre></td>
</tr>


3. Copy & Paste this section directly underneath it and edit is as shown here

<tr>
<td class="header-label" valign="top"><nobr>Last log entry:</nobr></td>
<td class="header-data"><pre><xsl:value-of select="comment"></pre></td>
</tr>
<tr>
<td class="header-label" valign="top"><nobr>SVN Revision:</nobr></td>
<td class="header-data"><pre><xsl:value-of select="changeNumber"/></pre></td>
</tr>


4. Save the changes to header.xsl
5. Open your browser and navigate to a build summary. The SVN Revision should now be shown.
6. You're done. Go get yourself a coffee.

6 comments:

  1. you forgot the closing tag for this:

    <xsl:value-of select="comment">

    should be:

    <xsl:value-of select="comment"/>

    ReplyDelete
  2. This is not working for me, I have a SVN revision header, but where does the change number actually come from?

    ReplyDelete
  3. The "changeNumber" element is in "modifications" element of the build log file. To see the build log, click on "View Log File" from the CCNET project page.

    The issue is that since the revision number (changeNumber) element is nested in the modifications element, it is only avaiable if changes have been made to the SVN repository. If a build is forced but not changes have been made, the revision number will not be available.

    ReplyDelete
  4. That's great.. thanks..

    You can make the same amendment in /server/xsl/header.xsl to change the emails that get sent, too.

    ReplyDelete