views:

2001

answers:

3

I'm trying to use CruiseControl 2.7.3, (the original), to build a Java project that is in an SVN repository.

My cruise configuration is using the svn plugin for the modification set. When a modification is detected, a build is scheduled using Ant. That Ant build file then uses the svnant Ant Task to do a complete checkout of the project. For a while, we had this set to just checkout "HEAD", but we've had cases where the build won't fire for a check in or two because the checkin occurred after the modification set check, but before the ant call to svn checkout. As a result, we are trying to change the ant build file to use the revision number that the modification check retrieves.

The CruiseControl Configuration Reference page claims that a property, svnrevision, is set and passed to the builders, just like the label property is by the labelincrementers. It appears to not be set when I press the force build button.

Is there something I need to do to make this go?

A: 

The cruisecontrol ant invocation has nothing to do with the (svn)label that is contructed as such. The svn label is used to annotate the build-names whereas the build.log is really just the output from ant as it is passed through cruisecontrol.

If you would like to have the revision number written to the ant build output, there are basically two ways:

One way is to have ant interact with svn in some way. Svn in ant is only available through a contrib ant task from tigris, so it is not trivial to put into your ant file. But with this in your build, you could do a svn info and get the revision number as ant properties at your disposal.

Another way is to use the svnlabelincrementer to assign the revision number to the label, and pass that onto the ant script using the buildproperties that are passed from cruisecontrol to the build scripts. As Jay mentioned in the comments, the label contains only the last successfull build revision, which is not what he wants. A fix has been proposed on this blog, but doing the work in the ant build file seems more suitable.

Steen
The svnlabelincrementer automatically sends its ${label} property already. Unfortunately, it isn't guaranteed to be just the latest revision from the working path. So you can't pass it into an update command.
Jay R.
A: 

Can you use the quietperiod setting? After a commit, CruiseControl can wait for some amount of time (say, 30 seconds) before kicking off a build.

It won't fire off individual builds for each commit. Rather, commits around the same time will kick off a single build.

CoverosGene
Setting the quietperiod only delays the build to wait for additional checkins that may be following the checkin that will trigger the build. This was really good for CVS, but for SVN its less useful. It doesn't help my issue though.
Jay R.
+1  A: 

Looking at the code for the SVN source control it seems that svnrevision should be passed along to the builder, and thus along to your Ant invocation. Have you tried using the property from your Ant script?

In response to the question in the comment:

That's because in the force build case there was no modification, so there's no modification revision number. In that case the svnlabelincrementer will pass the latest revision number for what you have locally, which will also be the latest.

Jeffrey Fredrick
I have an echo to print out the svnrevision property. I just added the tidbit about the force build button. I think that is the problem for real.
Jay R.
That's because in the force build case there was no modification, so there's no modification revision number. In that case the svnlabelincrementer will pass the latest for what you have locally, which will also be the latest.
Jeffrey Fredrick
I'll have to code around it for the script doing the checkout. I didn't realize that was a problem until today.
Jay R.