Environment variables in ccnet.config

537 views
Skip to first unread message

wads

unread,
Nov 1, 2007, 9:46:08 AM11/1/07
to ccnet-user
Hi,

Is it possible to use Environement Vairables in ccnet.config? I'm
using CruiseControl 1.3.

If so, what is the correct usage? Please provide an example.

If not, does anyone know why this hasn't been implemented yet?

Thanks for your help.

Paul Grenyer

unread,
Nov 1, 2007, 9:54:58 AM11/1/07
to ccnet...@googlegroups.com
Hi

Surely this must be a FAQ by now?

Regards
Paul

Paul Grenyer
e: paul.g...@gmail.com
w: http://www.marauder-consulting.co.uk

Sorry girls, I'm married now.

wads

unread,
Nov 1, 2007, 10:31:38 AM11/1/07
to ccnet-user
Yes, you'd think so if it's not possible but I cannot find anything.
There is an FAQ relating to 'environment variables when running under
ccnetservice' but nothing relating to ccnet.config specifically.

thanks


On Nov 1, 1:54 pm, "Paul Grenyer" <paul.gren...@gmail.com> wrote:
> Hi
>
> > Is it possible to use Environement Vairables in ccnet.config? I'm
> > using CruiseControl 1.3.
>
> > If so, what is the correct usage? Please provide an example.
>
> > If not, does anyone know why this hasn't been implemented yet?
>
> > Thanks for your help.
>
> Surely this must be a FAQ by now?
>
> Regards
> Paul
>
> Paul Grenyer

> e: paul.gren...@gmail.com

kiwidude

unread,
Nov 1, 2007, 10:39:51 AM11/1/07
to ccnet-user
Did you even try google search on the group? This comes up just about
every other week, in fact 35 results found just now...

For instance this answers your question exactly from Sep 24th...
http://groups.google.com/group/ccnet-user/browse_thread/thread/aaaa7d813284dfe1/0f5c37815aaad138?lnk=gst&q=environment+variables#0f5c37815aaad138

Grant.

> > Sorry girls, I'm married now.- Hide quoted text -
>
> - Show quoted text -

wads

unread,
Nov 1, 2007, 11:11:10 AM11/1/07
to ccnet-user
Thanks for that.

Any explanation as to why it's not implemented? I mean is there any
reason other than "it's just not done yet"?

On Nov 1, 2:39 pm, kiwidude <grant.dr...@gmail.com> wrote:
> Did you even try google search on the group? This comes up just about
> every other week, in fact 35 results found just now...
>

> For instance this answers your question exactly from Sep 24th...http://groups.google.com/group/ccnet-user/browse_thread/thread/aaaa7d...

Mike Frederick

unread,
Nov 1, 2007, 11:34:34 AM11/1/07
to ccnet...@googlegroups.com
Well, I am working on a method for specifying parameters to a NAnt
script running as a CruiseControl.NET task, and I can tell you one issue
I've come up with for why to not implement this capability. If the
CCNet project is running in CI mode I'm not certain I would want the
parameters of the project changing asynchronously in respect to the
detection of changes and firing of a project.

Nevertheless, there are many CCNet projects that would greatly benefit
from being able to change execution parameters and then manually fire
the project. Again, my work does not directly address changing values
in CCNet projects, but in a NAnt task that gets executed by CCNet.

Strictly speaking, is what you are asking even possible? The ccservice
is already running; how do you go and poke an environment variable value
into an already executing process? In order to get this functionality,
you would need to trigger some code already in the process space to wake
up and read an external object, such as a file. I suppose some sort of
shared memory approach might also work. But not environment variables.

wads wrote:
> Thanks for that.
>
> Any explanation as to why it's not implemented? I mean is there any
> reason other than "it's just not done yet"?
>
>


--
Mike Frederick
mi...@theFrederickHome.name

Ross Patterson

unread,
Nov 1, 2007, 11:35:56 AM11/1/07
to ccnet...@googlegroups.com
wads writes:
>Any explanation as to why it's not implemented? I mean is there any
>reason other than "it's just not done yet"?

There's a school of thought that says that Continuous Integration
systems like CCNet should be as independent of the surrounding
environment as possible, and that by implication, use of environment
variables set outside the configuration is a bad idea.

What are you trying to do? What is there in your CCNet configuration
that you would want to have change automatically if a Windows
environment variable changed?

Ross
________________________________

Ross A. Patterson, CISSP
Sr. Director, Development
Tel: +1 703-390-0865
RPatt...@QKnow.com

Q.Know Technologies, Inc.
11600 Sunrise Valley Drive, Suite 300
Reston, VA 20191
www.QKnow.com

wads

unread,
Nov 1, 2007, 12:12:22 PM11/1/07
to ccnet-user
I have a complex build dev with many snv branches. Each branch is
built using a different CCNet project on a different server. The only
real config difference between each build is the branch name in the
svn trunkUrl element.

I was thinking that rather than have to deply a difference
ccnet.config on each server, I could simply change an environement
variable on each server.

Can you think of a better way to do this?

Thanks

On Nov 1, 3:35 pm, "Ross Patterson" <RPatter...@qknow.com> wrote:
> wads writes:
> >Any explanation as to why it's not implemented? I mean is there any
> >reason other than "it's just not done yet"?
>
> There's a school of thought that says that Continuous Integration
> systems like CCNet should be as independent of the surrounding
> environment as possible, and that by implication, use of environment
> variables set outside the configuration is a bad idea.
>
> What are you trying to do? What is there in your CCNet configuration
> that you would want to have change automatically if a Windows
> environment variable changed?
>
> Ross
> ________________________________
>
> Ross A. Patterson, CISSP
> Sr. Director, Development
> Tel: +1 703-390-0865

> RPatter...@QKnow.com

Ross Patterson

unread,
Nov 1, 2007, 2:53:05 PM11/1/07
to ccnet...@googlegroups.com
wads writes:
>I have a complex build dev with many snv branches. Each branch is
>built using a different CCNet project on a different server. The only
>real config difference between each build is the branch name in the
>svn trunkUrl element.
>
>I was thinking that rather than have to deply a difference
>ccnet.config on each server, I could simply change an environement
>variable on each server.

The usual way folks address that sort of issue is to use a XML DTD
entities. Something like this for your ccnet.config:

<!DOCTYPE cruisecontrol [
<!ENTITY ProjectName "MyProject">
<!ENTITY MyVariable2 "MyValue2">
<!ENTITY CommonFile SYSTEM "file:common.xml">
]>
<cruisecontrol>
&CommonFile;
</cruisecontrol>

And then in common.xml:

<project name="&MyProject;">
<tasks>
<devenv configuration="&MyConfiguration" .../>
...
</tasks>
</project>

Ross
________________________________

Ross A. Patterson, CISSP
Sr. Director, Development
Tel: +1 703-390-0865

RPatt...@QKnow.com

Thibaut Barrère

unread,
Nov 5, 2007, 6:34:10 AM11/5/07
to ccnet-user
Hi,

> I was thinking that rather than have to deply a difference
> ccnet.config on each server, I could simply change an environement
> variable on each server. Can you think of a better way to do this?

I use a mixed approach: I use a tool to generate my configuration
files. I keep things DRY in the generator itself, where I'm free to
use variables and more advanced logic if it's necessary. When I need
to deploy the configuration with slight variations (eg: build a new CI
server with staging settings or production settings), I introduce a
configuration file (eg: YAML, usually stored in SVN itself) or a
configuration logic (eg: switch case in the generator).

This generator is kept in a well-known SVN location, and creating a
new instance requires an initial checkout, then running the tool with
bootstrapping parameters.

How I've chosen to implement this: today I'm using Ruby, Rake and XML
Builder templates [1], while in the past I had been using NAnt,
QuickGraph, or even CodeSmith. It has proven to be very efficient for
me.

hope this helps!

cheers

Thibaut Barrère / LoGeek
--
http://www.dotnetguru2.org/tbarrere
http://www.logeek.fr

[1] http://www.xml.com/pub/a/2006/01/04/creating-xml-with-ruby-and-builder.html

mik...@ev1.net

unread,
Dec 28, 2007, 11:39:38 AM12/28/07
to ccnet-user
I do have this solution working...unfortunately I do not yet have
permission from my supervisor to release anything.

But I can describe what I did.

First I have to state that I agree with the discussion on this thread
about not having CI interact with its environment at this level.

Having said that, I will now state that there are *some* very good
situations where specifying parameters to a project defined in
CruiseControl.NET makes perfect sense. My scenario is as follows: A
deployment project is defined. We have to deploy multiple components
to multiple deployment environments. To get all of the possibilities
defined would take tens of projects; and the projects would all vary
by 2 string parameters. Just this sheer number of deployment projects
invites clicking the wrong button, etc.

So what I did was define an XML format to specify parameters, write a
small Adobe Flex app to read the file and dynamically display a dialog
to ask the user to select the parameters, modify the CCNet
projectGrid.vm file to add a "Params" button and fire the flex app.
Upon the user clicking the OK button in the flex app, a call is made
to a web page in the CCNet webdashboard location that writes a NAnt
parameter file in the working directory of the appropriate CCNet
project. Then the user may press the Force button and start the
project with those parameters.

This allows me to create one Deploy CCNet project instead of 48 or
so. When we are rolling-out a component of software out to a
particular environment I press Params, pick the components and target
environment, press OK and then press Force.
> m...@theFrederickHome.name

Jixiu Li

unread,
Jul 20, 2015, 4:34:33 AM7/20/15
to ccnet...@googlegroups.com


I have another question about 

cb:define name="version"

<cb:define name="myversion"> 
<exec>
<executable>c:\Windows\System32\cmd.exe</executable>
<buildArgs>
/C type "version.txt"
</buildArgs>
</exec> 
</cb:define>

myversion was defined to c:\Windows\System32\cmd.exe. I want to define it to the data in version.txt. any suggestion? 

Thanks

Jixiu

Reply all
Reply to author
Forward
0 new messages