Richie086
Richie086

Reputation: 111

CruiseControl.net - running as a service on multiple build machines

I have a Cruise Control (v1.5.726) install with various projects being built on several machines. Each machine builds whatever projects it is configured to run, and if the build is sucessful a copy of the output is placed on a web server so it can be accessed internally. I have a SVN branch that contains a 'golden' (known working) CC.net install, so when I want to add another build machine, all I need to do is sync the SVN branch to that machine and create a batch file that calls ccnet.exe, which then references the .ccnet.config file that contains the list of projects that each machine is responsible for building.

Yesterday I figured out how to setup CC.net as a Windows service, but I do not seem to be able to pass any parameters to ccservice.exe like I could with ccnet.exe. The only way I have been able to get ccservice.exe to load the machine specific configuration, is by adding a line to the ccservice.exe.config file that references back to the machine config. For example

<add key="ccnet.config" value="C:\CruiseControl\Config\Machine-Name.ccnet.config"/>

Now, considering the fact that I have multiple build machines and the configuration files are being stored via SVN - commiting ccservice.exe.config back to SVN would cause issues since it refers back to a config file for a single machine.

My question is - is there some way to pass command line arguments (or some way to tell ccservice which config file to look at) to ccservice.exe OTHER than via the ccservice.exe.config file? I tried ccservice.exe /? but I just see the popup message that says you have to use IntstallUtil.exe to install CC.net as a service.

I am using CC.net Version : 1.5.7256.1 The build machines are running Windows 7 Enterprise. Intel Core i7-2600K CPU. 16GB RAM.

Let me know if you need any further information.
Thanks Richie

Upvotes: 1

Views: 729

Answers (2)

csm8118
csm8118

Reputation: 1213

One thing you could try is have this particular value in a file outside of ccservice.exe.config. See this question for reference: Does the appsettings file attribute override what is in the app.config?

I would think your ccservice.exe.config would look something like

....
<appSettings file="local.config">
  <add key="service.name" value="CCService" />
  ... other existing keys in appSettings ...
<appSettings>

Then local.config would look like

<appSettings>
  <add key="ccnet.config" value="C:\path\to\machine-name.ccnet.config" />
</appSettings>

Doing it this way when setting up a new machine you would need to create the local.config and the machine-name.ccnet.config, but your ccservice.exe.config would not need to change between machines.

Upvotes: 0

weston
weston

Reputation: 54811

Can you use an enviroment variable? COMPUTERNAME is already there.

<add key="ccnet.config" value="C:\CruiseControl\Config\%COMPUTERNAME%.ccnet.config"/>

Maybe it will expand the variable, I've not tried.

Upvotes: 1

Related Questions