Hi,

I've been using CruiseControl.NET (1.4.4 sp1) for some time and love it.
Recently, we have found a need to customize some features to leverage all
our resources.  We have several large projects with test automation and
these (functional) suites can take up to 24+ hours [each] to run.  So, I
want to leverage all 3 machines to be used as a true build farm.

I have written a custom trigger that will look at a database table and check
for pending builds for any of our products.  If a row exists, it will force
a build.  However, my problem is that all 3 machines will queue up that same
row no matter what.  I have tried updating the row to reserve it, but even
that doesn't work.  Whichever ccnet instance grabs the build and executes it
- it works fine.  But the 2 other servers that have already queued it up
will fail.

What I was looking to do was get a status of each project on that ccnet
server.  If there was a running or pending build already, I would tell it to
keep waiting.  Here is the code I was trying to use to get the status on
each project.

private static bool isThereAPendingBuild()
        {
            XDocument config = XDocument.Load("ccnet.config");

            var projects = from p in
config.Element("cruisecontrol").Elements("project")
                           select p;

            foreach (var project in projects)
            {
                string projectName = project.Attribute("name").Value;

                Project p = new Project();
                p.Name = projectName;
                Console.Out.WriteLine("p.QueueName = {0}", p.QueueName);
                Console.Out.WriteLine("p.Activity.IsPending() = {0}",
p.CurrentActivity.IsPending());
                Console.Out.WriteLine("p.Activity.IsBuilding() = {0}",
p.CurrentActivity.IsBuilding());

                if (p.CurrentActivity.IsPending() ||
p.CurrentActivity.IsBuilding())
                    return true;
            }
            return false;
        }

I looked through all the source code of ccnet, and just didn't know where to
start - so I figured this could work too.  However, it seems each Project in
the ccnet.config file is running in its own thread - so it's hard to step
through the code and troubleshoot it.

Any ideas?  Thanks.

Reply via email to