how to call multiple project from different path in ccnet config file - cruisecontrol.net

I have a multiple project which is defined in ccnet.config file in below.it's very confusing to read.there is anyway, we can split these project file in some location path.and call these project file in ccnet config.please help me out for these issue.
<cruisecontrol>
<project name="project1">
...
</project>
<project name="project2">
...
</project>
</cruisecontrol>

It's better to use the pre-processor, it will also the system when one of the sub-files change.
http://www.cruisecontrolnet.org/projects/ccnet/wiki/Configuration_Preprocessor
You can look at an example here :
http://www.cruisecontrolnet.org/projects/ccnet/wiki/Scenarios
Step 2 Build on Check-in, and next steps.
It will show you how that example config grows when there are new requirements for the build server.

<!DOCTYPE cruisecontrol [
<!ENTITY project1 SYSTEM "file:project1.xml">
<!ENTITY project2 SYSTEM "file:project2.xml">
]>
<cruisecontrol>
&project1;
&project2;
</cruisecontrol>
From:
http://www.cruisecontrolnet.org/projects/ccnet/wiki/TheCruiseControlConfigurationBlock
Note, the one "gotcha" is that if you change any of the "sub-file"'s, the system will not recycle ....... (as it would if you made a change to ccnet.config ).
The work around is to change the sub-file, then add a space (or take a space) (or some other whitespace character) in the ccnet.config file).

Related

How to hide Tomcat version from error messages when using embedded servers in Java

I have a java application where i'm using embedded Tomcat servers,
which looks like this
Tomcat tomcat = new Tomcat()
I'm creating an embedded tomcat server here.
Problem statement
whenever there's an error it displays information on which tomcat version i'm using,
how to hide this in java?
i have a little idea that i need to override ServerInfo.properties, but how do i do this?
I'm not sure how we can do this in java, but if you are using any build scripts like ant / gradle for distribution purpose, we can write a task to override / harden the jar file, and replace the ServerInfo.properties file with the customized value whatever we need.
the code for ant build scripts would look like
<target name="override.tomcat">
<jar destfile="path/to/tomcat-embed-core-9.0.62.jar" update="true">
<fileset dir="src/"> <!-- folder where you keep the directory/file to raplace-->
<include name="org/apache/catalina/util/ServerInfo.properties"/> <!-- file to replace within directory path in side the jar-->
</fileset>
</jar>
</target>
and in gradle
task overRideTomcat(type: Jar) {
from(zipTree(file("path/to/tomcat-embed-core-9.0.62.jar"))) {
exclude '**/org/apache/catalina/util/ServerInfo.properties'
}
from('src/') {
include('/org/apache/catalina/util/ServerInfo.properties')
}
archiveName "tomcat-embed-core-9.0.62.jar"
}
make sure you have the modified ServerInfo.properties file under src directory in the same path as you have mentioned in the include statement.

Server Error in '/ccnet' Application

My CCTray says build is broken and on the server(http://172.25.165.10/ccnet/)
I get this error
Server Error in '/ccnet' Application.
Configuration Error
<cruisecontrol xmlns:cb="urn:ccnet.config.builder">
<!-- This is your CruiseControl.NET Server Configuration file.
Add your projects below! -->
<project name="winapp"
description="demoproject showing a small config" queue="Q1">
<webURL>http://172.25.165.10/ccnet/</webURL>
<!-- specify a state folder to prevent CCNet from saving it in Program Files\CruiseControl.NET\server
programs may not standard write their data in it on windows Vista and up)
-->
<sourcecontrol type="svn">
<trunkUrl>https://citdevbox.arcade.local:8443/svn/cardwellR/trunk/winapp</trunkUrl>
<workingDirectory>c:\builds\winapp</workingDirectory>
<username>***</username>
<password>***</password>
</sourcecontrol>
<state type="state" directory="C:\CCNet\State" />
<!-- specify a artifactDirectory to prevent CCNet from saving it in Program Files\CruiseControl.NET\server
programs may not standard write their data in it on windows Vista and up)
-->
<artifactDirectory>C:\CCNet\BuildArtifacts\MyFirstProject</artifactDirectory>
<tasks>
<msbuild>
<executable>C:\WINDOWS\Microsoft.NET\Framework\\v3.5\MSBuild.exe</executable>
<projectFile>C:\Builds\build\BootStrapper.msbuild</projectFile>
<buildArgs>/noconsolelogger /t:CTSx86;BuildZip /v:d</buildArgs>
<logger>ThoughtWorks.CruiseControl.MsBuild.XmlLogger,C:\Program Files\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll</logger>
<timeout>900</timeout>
</msbuild>
</tasks>
<triggers>
<!-- check the source control every X time for changes,
and run the tasks if changes are found -->
<intervalTrigger
name="continuous"
seconds="300"
buildCondition="IfModificationExists"
initialSeconds="5"/>
</triggers>
<publishers>
<xmllogger />
<artifactcleanup cleanUpMethod="KeepLastXBuilds"
cleanUpValue="50" />
</publishers>
</project>
</cruisecontrol>
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: The root element must match the name of the section referencing the file, 'appSettings'
Source Error:
Line 1: cruisecontrol xmlns:cb="urn:ccnet.config.builder"
Source File: C:\Program Files (x86)\CruiseControl.NET\server\ccnet.config Line: 1
Version Information: Microsoft .NET Framework Version:2.0.50727.5456; ASP.NET Version:2.0.50727.5456
You didn't post the content of your ccnet.config file which the error you are getting is complaining about. Lets start with the obvious. I would look to see if there is a typo in there, for example maybe a missing quote or something in the appSettings section. If you have the unmodified version revert back to that and see if your issue goes away and compare the unmodified with the modified.
There is an app called CCValidator which will tell you where the error is in your ccnet.config file. I suspect that is not where the problem is. It sounds like the error is in the ccservice.exe.config. Perhaps someone accidentally copied ccnet.config to ccservice.exe.config. The error may also be in your web dashboard's configuration.
I solved the issue by removing the build args tag.
</noconsolelogger /t:CTSx86;BuildZip /v:d>
My processor was 64 bit and I was using noconsolelogger /t:CTSx86 which is for a 32 bit processor. Anyway these were optional so I removed it worked fine.

Merge Publisher - what does <file action="Copy"> actually do in CruiseControl.Net?

I inherited a project that runs TestComplete scripts from CruiseControl.
For each Script there is an entry in CCnet.Config and each entry ends with the following:
<publishers>
<merge>
<files>
<file action="Copy">
C:\Test\Log\TestCompleteResult\TestWebLog.mht
</file>
</files>
</merge>
<xmllogger />
<statistics />
Which I assumed copies the TestComplete log to that location. However, if I change the location (i.e. to C:\test\log2\TestWebLog.mht), the file still ends up in C:\Test\Log\TestCompleteResult. I have tried shutting down CruiseControl, rebooting the system etc. and the file still ends up in the same location.
I have deleted the directory and file, checked the time stamp and looked at the log file. All indicate that it is a new file created by the most recent run of the TestComplete script, but it always gets put in the same location: C:\Test\Log\TestCompleteResult\TestWebLog.mht.
Is there some place else this path could be defined?
From the CruiseControl.NET Wiki :
Copy: instead of merging the data into the build log, it will copy the specified files into a "build" folder under the artefacts folder for the project
In ccnet.config you can specify an artifact directory for each project into which the build results will be placed.
<project name="Project">
<artifactDirectory>C:\ProjectDir\artifacts</artifactDirectory>
...
</project>
The default merge action is to combine the specified file with the result.xml found in the artifact directory.
The "Copy" merge action copies the specified file into the artifactdirectory\Build folder.
The file you specify in the <file>...</file> tags is the source file that will be copied to the artifact folder.
The <merge> publisher includes an existing file in the build report. If you want to change the location in which the file is generated, you need to change the task configuration (i.e. in the place where TestComplete gets actually invoked).

Cruise Control: Web-based Source Control Configuration

Currently I have this sourcecontrol config block.
<sourcecontrol type="svn">
<trunkUrl>https://SampleSVNOnlineRepository.com/12maksdde12d123ede12</trunkUrl>
<workingDirectory>c:\MyProject</workingDirectory>
<username>admin</username>
<password>mypassword</password>
</sourcecontrol>
Cruise Control Exception:
Source control failure : Unable to execute file [c:\MyProject\svn]. The file may not exist or may not be executable.]
What seems to be the problem here?
It means that CruiseControl.NET cannot find the svn executable. You'll have to specify it with the executable element, e.g:
<sourcecontrol type="svn">
...
<executable >absolute\path\tp\subversion\executable</element>
Did you checkout the project first by hand in that location? As I understood when I played with phpUnderControl, which uses CruiseControl, you do the first checkout by hand.

CruiseControl.NET post-build actions

We have CC.NET setup on our ASP.NET app. When we build the project, the ASP.NET app is pre-compiled and copied to a network share, from which a server runs the application.
The server is a bit different from development box'es, and the next server in our staging environment differs even more. The difference is specific config files and so on - so I want to exclude some files - or delete them before the pre-compiled app is copied to a network share.
My config file looks like this:
<project name="Assembly.Web.project">
<triggers>
<intervalTrigger seconds="3600" />
</triggers>
<sourcecontrol type="svn">
<trunkUrl>svn://svn-server/MyApp/Web/Trunk</trunkUrl>
<workingDirectory>C:\build-server\Assembly\Web\TEST-HL</workingDirectory>
<executable>C:\Program Files (x86)\SVN 1.5 bin\svn.exe</executable>
<username>uid</username>
<password>pwd</password>
</sourcecontrol>
<tasks>
<msbuild>
<executable>C:\Windows\Microsoft.NET\Framework64\v3.5\MSBuild.exe</executable>
<workingDirectory>C:\build-server\Assembly\Web\TEST-HL</workingDirectory>
<projectFile>C:\build-server\Assembly\Web\TEST-HL\Web\Web.sln</projectFile>
<buildArgs>/noconsolelogger /p:Configuration=Debug /v:diag</buildArgs>
<targets>Build</targets>
<timeout>900</timeout>
<logger>C:\Program Files\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll</logger>
</msbuild>
</tasks>
<publishers>
<buildpublisher>
<sourceDir>C:\build-server\Assembly\Web\PrecompiledWeb</sourceDir>
<publishDir>\\test-web01\Web</publishDir>
<useLabelSubDirectory>false</useLabelSubDirectory>
<alwaysPublish>false</alwaysPublish>
</buildpublisher>
</publishers>
</project>
As you can see, I use a buildPublisher to copy the pre-compiled files to the network share. What I want to do here, is either 1) delete certain files before they are copied or 2) replace those files after they have been copied.
I DO NOT want to have some app running watching specific files for change, and then after that replace the files with other ones. I want something to be either done by CC.NET, or triggered by CC.NET.
Can you launch a .bat file with CC.NET?
I use a NAnt task for all publishing, deploying, cleaning and so on.
Take a look at MSDEPLOY or Web Deployment Projects. There is a question that will provide more detail here
You have to use NAnt for those kind of stuff.
Here is the Task Reference of Nant..
Of course CruiseControl.NET can run a batch file, simply use the exec task. However, an easier answer might just be to have MSBuild do the task for you. It should be simple to add a few steps in the postcompile target.

Resources