Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pass an integration property to a batch file with CruiseControlNet?

In the build log of my project, i can see these properties:

<integrationProperties>
  <CCNetProject>Gdet_T</CCNetProject>
  ...
  <LastModificationDate>4/6/2010 1:29:04 PM</LastModificationDate>
  <LastChangeNumber>10841</LastChangeNumber>
</integrationProperties>

I want to pass the property CCNetProject and LastChangeNumber to a batch file. it works well with CCNetProject, as it can be used in the batch as an environment variable %CCNetProject%.

But it doesn't work with other properties (those are not starting with the CCnet prefix) as LastChangeNumber or LastModificationDate.

I tried to pass it as argument, but it fails !

<exec>
  <executable>$(WorkingFolderBase)\MyBatch.bat</executable>
  <baseDirectory>$(WorkingFolderBase)\</baseDirectory>
  <buildArgs>$(LastModificationDate)</buildArgs>
</exec>

I tried to pass it as environment variable, but it fails:

<exec>
  <executable>$(WorkingFolderBase)\MyBatch.bat</executable>
  <baseDirectory>$(WorkingFolderBase)\</baseDirectory>
  <environment>
    <variable>
      <name>svn_label</name>
      <value>"${LastModificationDate}"</value>
    </variable>
  </environment>
</exec>

The results is always the same when I display the parameter or variable : empty string or the variable name $(svn_label)

I'm sure it is simple, but ... I can't find ! Any idea ?

like image 979
TridenT Avatar asked Apr 07 '10 11:04

TridenT


1 Answers

CCNET passes the following parameters to external programs:

CCNetArtifactDirectory 
CCNetBuildCondition 
CCNetBuildDate 
CCNetBuildTime 
CCNetFailureUsers 
CCNetIntegrationStatus 
CCNetLabel 
CCNetLastIntegrationStatus 
CCNetListenerFile 
CCNetModifyingUsers 
CCNetNumericLabel 
CCNetProject 
CCNetProjectUrl 
CCNetRequestSource 
CCNetUser 
CCNetWorkingDirectory 

As you can see LastIntegrationStatus e.g. is available through CCNetLastIntegrationStatus but LastModificationDate e.g. has no equivalent.

You can pass additional arguments via <buildArgs> or <environment> but inside CCNET configuration you have no access on the integration properties mentioned above. Most people starting with CCNET (including myself) try something like <buildArgs>$(CCNetProject)</buildArgs> and fail.

Have a look on my answer to a similar question.

Sorry I can't provide a better solution.

Update (regarding Thinker's suggestion):

Using $[$CCNetLabel] inside CCNET configuration does not seem to work.

Frankly spoken, I would have been rather surprised, if it had. The configuration is something static whereas CCNetLabel is something dynamic, that potentially changes with every integration build. Assuming you have access to these dynamic properties inside the configuration, the configuration might change with every build. Since changing the configuration means restarting the CCNET server automatically, you would cause a server restart with every build. Not actually a desirable behavior, is it?

like image 56
The Chairman Avatar answered Nov 15 '22 09:11

The Chairman