Last weekend, I sat down and decided to install one of my crappy computer as
a Source Control and
Continues Integration machine. What I need is
Subversion source control and other
bits and pieces to have a fully functional
Source Control
System.
I put down my requirements first so that I can measure the quality of my work
later.
My requirements are:
- A source control system is necessary to keep track of different
projects.
- Source Control should be browse able with a browser.
- Source code should be colored in browser for easy reading.
- Source Control should be used for different technologies like .NET,
Java, PHP, Pearl etc.
- The System should compile the code automatically when there is a change
in Source Control.
- The System should deploy the executables to proper servers for further
tests.
- The System should run the Nunit tests and reflect the results.
- An Issue tracking system should be exist.
- Issue Tracking system should have a connection to Source Control. So
that each defect can be tracked down in code.
- Development machines should be able to check-in and out the code
- Developers should be warned if tests are not successful.
- Developers should be informed when the defects are assigned to them.
After I put down my requirements, I have started to work. First off all, I
have installed a clean Windows XP Professional on a Celeron 500, 128mb ram, 40gb
HD machine. I have installed IIS, Service Pack 1, and all other updates
available on Windows Update
site. .NET Framework 1.1 is also available from the Windows Update.
I knew, I was going to use Subversion as the bases of this continues
integration machine. It is free, open source and easy to install and use. I have
downloaded latest version from www.tigris.org
and installed without a problem. Don't
forget to add the subversion\bin directory to your PATH variable.
Now, I need to create my repository database. Create a directory called
"Repository" in your C: drive and enter the following command on DOS Shell:
C:\>svnadmin create C:\Repository
And also to secure the repository with a user id and password, I have changed
configuration and added my name and a password to passwd file. I don't know if
there is a way to hash the passwords in this file, it looks like so vulnerable.
Go to
C:\Repository\conf and open
svnserve.conf file with your text editor. Uncomment the lines below.
[general]
anon-access = none
auth-access = write
password-db = passwd
Create a new file in the same folder
called passwd and enter the lines below. This is a user
name and password pair.
[users]
gurkan = asdfgh
I also need the Subversion service running all the time so that I don't have
to login to the machine and start the service manually. To install the
subversion server as a service I have downloaded
SvnService
and copied SVNService.exe into Subversion\bin directory. To install the
service go to DOS shell and enter:
C:\>SVNService -install -d -r C:\Repository
And to start the service:
C:\>net start SVNService
My first requirement is alright now. I have a fully functional Source Control
System. My second requirement was to be able to browse the Source Control over
the intranet with a browser. So developers don't need to install another
application to browse the Source Control. There are couple of choices for
Subversion, I have downloaded WebSvn. WebSVN is
a PHP application so I also need the
PHP installed and configured to work with IIS. Download the 7.8meg zip
package. You may need other things later if you want to run MySql like
applications. Extract the package to hard disk and add the directory where the
php5isapi.dll resides to your PATH variable. You also need to register this dll
in Internet Information Services as an ISAPI filter. Right click on your Default
Web Site go to properties and ISAPI Filters tab.
Add php5isapi.dll by clicking
the Add button. Give the name php for the Filter Name.
I have extracted and copied WebSVN to the inetpub\wwwroot directory and
created an application on IIS on WebSVN directory.
Change the name of the file
distconfig.inc to config.inc in WebSvn\include directory. I need to adjust couple of
things in config.inc file. These are:
// For syntax colouring, if option enabled...
//My Enscript installation is in
C:\Enscript1639
//Also C:\Enscript1639\bin is in PATH
$config->setEnscriptPath("C:\\enscript1639\\bin");
// To configure the repositories by hand, copy the line
below, uncomment it and replace the name and path
$config->addRepository("Repository", "C:\\Repository");
.
.
// --- BUGTRAQ ---
// Uncomment this line if you wish to use bugtraq: properties to show links to
your BugTracker
// from the log messages.
$config->useBugtraqProperties();
When I was reading the file config.inc, I have seen an entry for colouring the
code. I thought, maybe this thing will make it easier for my third requirement.
It was requiring an Open Source application called
EnScript 1.6.3
(don't forget to download dependencies). After a bit of
reading about it I have realised that EnScript is a scripting engine based on
state definitions to produce colored html outputs. For each file extension you
need to have a state file in a certain directory to make it colored. As usual
there was no support for C# and VB.NET. I have found a state file on Sourceforge
for C# but no luck for VB.NET. You can download this file from
this link. Also need to register the .cs
extension in WebSVN's config.inc file.
//
--- COLOURISATION ---
// Uncomment this line if you want to use Enscript to colourise your file
listings
// You'll need Enscript version 1.6 or higher AND Sed installed to use this
feature.
// Set the path above.
$config->useEnscript();
//Register cs extension here
$extEnscript[".cs"] = "csharp";
There are also options for diff, gzip and sed (I don't know what sed is). But
you need to install CygWin to get these. CygWin is a project to provide Unix
shell tools on Windows 32bit systems. I have fired up CygWin installation and
selected all the packages (that was a mistake). Installation took nearly a day
because of the selected modules and all downloaded first before installation.
You need to provide paths for each application (diff, gzip and sed) in
WebSvn's config.inc file. It is good because developers can download executables
as a zip file or look for differences between two versions of a file through the
browser. This is great, because I have even more functionality than my initial
requirements and they are certainly very useful to have. Here are the lines in
config.inc that you need to uncomment. Also download TAR from
here to be able
to download an entire folder from WebSVN.
// $config->setSVNCommandPath("Path/to/svn and svnlook/
e.g. c:\\program files\\subversion\\bin");
$config->setDiffPath("C:\\cygwin\\bin");
$config->setSedPath("C:\\cygwin\\bin");
// For delivered tarballs, if option enabled...
$config->setTarPath("C:\\Program Files\\GnuWin32\\bin");
// For delivered GZIP'd files and tarballs, if option
enabled...
$config->setGZipPath("C:\\cygwin\\bin");
.
.
.
// --- TARBALLS ---
// You need tar and gzip installed on your system. Set the paths above if
necessary
//
// Uncomment the line below to offer a tarball download option across all your
// repositories.
$config->allowDownload();
Another thing to do is to define the port 3690 for Subversion on Windows XP's
firewall so that you can access from other developer computers. I kept the scope
to subnet, so only internal network computers with this subnet can access to
Subversion service.
To download binary files as zipped you need to add these:
// --- FILE CONTENT ---
//
// You may wish certain file types to be GZIP'd and delivered to the user when
clicked upon.
// This is useful for binary files and the like that don't display well in a
browser window!
// Copy, uncomment and modify this line for each extension to which this rule
should apply.
// (Don't forget the . before the extension. You don't need an index between the
[]'s).
// If you'd rather that the files were delivered uncompressed with the
associated MIME type,
// then read below.
//
$zipped[] = ".dll";
$zipped[] = ".exe";
$zipped[] = ".class";
After everything set up, I've logged in to my developer machine and installed
TortoiseSVN 1.2.2 which works with Subversion 1.2.3 and it also claims that
there is a fix for VS.NET web projects. I have uploaded a small .Net project to
Subversion and browse to http://xpserver/WebSvn (xpserver is the machine that I
am setting up for Continues Integration) with Internet Explorer but I have got
an error message. Apparently the IUSR_XPSERVER user didn't have execute
permission on cmd.exe which is used by WebSVN to run Subversion commands.
Actually, giving this permission is a security risk but as long as this machine
is in intranet and not accessible from outside, I think it is safe. I set the
execute permission and it worked like a charm. Now I can access to Subversion
with Internet Explorer and when I click onto a .cs file it is displayed colored
like in VS.NET editor. Also when I click onto executables like .dll or .exe, it
downloads the file zipped. So my requirements 2, 3 and 9 are realised.
I have also installed
BugTracker.NET to coordinate issues and bugs in the
projects. One thing that I want is to hook issues to Source Code Control so that
every check-in and out process can be traced back to some issues, bugs or
enhancements. When you right click on a folder which is a project checked-out
from Subversion with TortoiseSVN, you will see an extra tab called Subversion
properties. Here you can set
bugtraq properties. These properties will provide
you an extra field to enter issue number when you are using TortoiseSVN to
check-in the project. This issue number will be a link to your issue tracking
software and this link is visible from WebSvn. Now, that's what I call
integration.

The bugtraq properties that I've used are:
bugtraq:label: this is the label for the Issue/bug number which will appear
on TortoiseSVN's check-in dialogue
bugtraq.url: This is the heart of this integration. The URL that you are
providing is the address of your bug/issue tracking software with a parameter at
the end which will be replaced by issue number. So my setting is
http://xpserver/btnet/edit_bug.aspx?id=%BUGID%. The parameter %BUGID% will
be replaced with issue number.
bugtraq.message: This will appear in WebSVN with the number linked to your
issue tracking software
bugtraq:number: Your issue tracking software may keep the issue sequence with
a combination of chars and numbers like IS1, IS2. If you give "true" for this
variable, only numbers can be entered when you are check-in the code.
bugtraq:warnifnoissue: If "true" and the developer did not enter an issue
number during the check-in, they will kindly be informed to enter.

Now the real continues integration part comes. For this purpose, I am using
Cruise Control.NET and
NAnt (with
NAnt Contribute). When there is a change on
registered projects the code should be checked-out and compiled. This will make
sure that the test environment will always have the latest executables. After
compilation of the code, testers should get an e-mail or some sort of
notification about the changes and start testing for that particular change.
CruiseControl.NET comes with an easy to follow installation package. It also
installs the service and creates Virtual Directory on IIS. Once you install,
everything is ready to use. I have also unzipped NAnt to a
folder and added NAnt\bin directory to PATH variable.
Unzip NAntContrib and copy bin directory
to NAnt\bin. Download
this little
project and unzip it to test NAnt installation. Open a dos prompt and get
into the project folder and enter:
C:\><projectfolder>\nant
You should get a BUILD SUCCEEDED message on the DOS prompt. If everything is
working we can change the ccnet.config to register the projects for continues
integration. Go to C:\Program Files\CruiseControl.NET\server
directory and edit ccnet.config file. Or you can download my copy
here. Please read
the file and do the necessary changes before you run the Cruise Control service.
The port 21234 needs to be added to Windows XPs firewall to
allow access from intranet for the Cruise Control.NET service. This
service will be checked with either CCNet Tray application or
FireFox CCNet plugin from the
developers computer.
If you browse to your continues integration computer with IE
http://xpserver/ccnet you will see something
like the below screen shot

For the NAnt integration, pleas check
my other blog entry. I think all my 12 requirements are realised. I am happy
and humble. What is next?