Jenkins

Jenkins (link), formerly known as Hudson (link), is an Open Source CI server written in Java. I found it to be extremely easy to set up and get running.

Installation

To "install" Jenkins, just copy the .war file. It can be started with the .cmd file. There is also an installation package available for download. It will install the service, too, so no manual hassling needed.

Jenkins has to run with 32-bit Java for some reason. Can't run with 64-bit version.

Plugins to install:

* Artifact Uploaders

FTP-Publisher

HTML-Publisher

*

Mercurial

MSBuild

NUnit

Configuration:

Install as a windows service.

Enable Active Directory integration. Set up users. Test Active Directory integration at http://server/securityRealm/test. To log in to Hudson, use just your AD username, without specifying the domain in the input box.

Set up Mercurial path.

Set up MSBuild path to C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe

Create projects.

Matrix project:

Create axes with parameter ProjectName and add the project names to the value list if the solution has multiple projects.

Create Axes with parameter Configuration and values "Test Stage Release".

Set the build configuration to build in sequence.

Parameters are passed to MSBuild as -P:ParamName=ParamValue

In the MSBuild parameters set "/p:SolutionName=<solution name>". Use the absolute path for MSBuild Build File parameter (i.e. c:\blabla\CIBuild.xml).

Running Unit Tests

To run NUnit tests, add the NUnit bin path to the Path environment variable.

Then, in your build project, add a Windows batch file build task to have nunit-console run the tests in the test dlls.

To allow running tests on .Net framework v4.0, apply the tips in the following article.

See attached runNUnitTests.cmd at the bottom of this page for a sample script that calls NUnit.

NUnit plugin can integrate unit test run results into Hudson.

Use "*.Tests.xml" as the parameter for NUnit plugif if using the attached batch file.

Troubleshooting

java.util.concurrent.ExecutionException: java.net.BindException: Address already in use: JVM_Bind

Remove Selenium plugins.

To remove a plugin, delete .hpi file.

###########################################

Command line for MSBuild looks like this:

[VE.Clients.Service.Complaints] $ cmd.exe /C "C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe " /p:Configuration=%Configuration%;SolutionName=VE.Clients;ProjectName=%ProjectName% -P:ProjectName=VE.Clients.Service.Complaints -P:Configuration=Test CIBuild.xml && exit %%ERRORLEVEL%%

TimeStamper functionality conflicts with Mercurial plugin. Mercurial can not retrieve the code when TimeStamper is active.

Variables

There is a useful page about environment variables - Administering Hudson. Also see Building a Software Project (link).

Upgrade

The upgrade instructions available here.

To upgrade Jenkins, running as a service, the steps are:

    1. Stop the service
    2. Replace jenkins.war