CruiseControl.NET is an automated build system ported from Java to the .NET framework. The current stable release of CCNET is v1.4.3. Unfortunately this version of CCNET does not natively support using Git as a source control provider. So if you’re making the switch from (say) SVN or VSS, at the time of writing, you will have a few bumps in the road ahead. NB: This page assumes you have a working copy of git running on your machine
To get Git working with CCNET, I found the excellent ccnet.git.plugin project on Github. This code is a plugin for CCNET which exposes basic functionality (and a little more) to allow CCNET to use Git as a source repository.
Firstly you need to download said source and compile the binaries. In case you’re super lazy, here’s one I prepared earlier – ccnet.git.plugin binary download
The plugin works by dropping it straight into your CCNET server’s folder with the other binaries. In most cases, this will be c:Program FilesCruiseControl.NETserver. Make sure your restart CCNET.
The next thing is to configure your project to use git as the source control provider. The README has an excellent example of how to configure the project. My initial project block ended up looking something like this (renamed to protect the innocent):
<project name="FittingApp.Project" queue="FittingApp.Project"> <sourcecontrol type="git"> <repository>git@bumblebee:FittingProject.git</repository> <timeout>30000</timeout> <executable>c:program filesgitbingit.exe</executable> <workingDirectory>C:buildprojectsFittingApp.Project</workingDirectory> </sourcecontrol> <triggers> </triggers> <tasks> </tasks> <publishers> <xmllogger /> <statistics /> </publishers> </project>
One important thing to note is that the README (at the time of writing) doesn’t mention the timeout element you can use in your configuration. The default value is quite high. I prefer to lower it and found this property by perusing the tests.
Finally after all that, everything should be done and ready to rock, right? Turns out not so. One problem I stumbled into (and took a while to resolve) was the build timing out when it was doing a fetch. The CPU was idle and there was no traffic over the network. The process would timeout and the build would fail. The funny thing was that I could open a command-prompt console myself and fetch the remote repo no problem. But when being performed by CCNET, it would timeout during the fetch.
Afer digging further, it looked like the SSH authentication wasn’t working and that the auth process didn’t accept the default SSH credentials I created earlier. I suspect it was waiting for me to enter a password for the remote git account. Of course there’s no interaction with this process so eventually it times out. After a long back-and-forth with the problem, I got in touch with the author of the plugin and he suggested checking that the HOME environment variable is set to %USERPROFILE%, otherwise git wouldn’t be able to find the git config settings. This solved the problem, and the build started working sweet. (big props, Kevin – thanks :))
With all that done, you should now be staring down the barrel of a CCNET installation successfully talking to Git. Hope this helps someone else out there.
Hey, thanks for this post. I have the exact same problem that appears to be the same as the one you resolved by setting the HOME environment variable to %USERPROFILE%. Regrettably, your HOME solution doesn’t solve the problem. Would you have any other suggestions?
Thanks
@Rodney I guess the first thing is making sure you’ve set the HOME variable correctly. Did you add it as a user variable, or a system variable? You need to set it as a user variable.
If you open a command prompt and type “set”, you should see an entry for your HOME as something like “HOME=C:UsersXerxes”, where %USERPROFILE% would be interpreted to give you the right path.
I don’t understatand why setting HOME variable to %USERPROFILE% should help, for me doesn’t. I run ccnet as a windows service on LOCALSystem account.
I create ssh key and at default it is in c:Usersksirg, when I start ccnet service i supose that is looks for .ssh folder in c:userslocalsystem but it doesn’t exists there.
Could you help me and say where i should keep my ssh key, and for whom I have to set HOME viarable administrator, localsytem, ksirg?