I am working in CCNet version 1.4, and I am having difficulty getting the parameters I want defined in a clean manner. In my example, I want 6 total projects as (3 solutions in 2 branches). I defined a generic project that could incorporate all 6 possibilities based on choice of 8 variables. When it's a trunk project, 4 of the variables should be one thing. When it's a branch project, the 4 variables should be another thing. The other 4 variables are dependent on which solution I want to build.
In my attempt below, I put the 4 trunk variables in one define block and the 4 release variables in another block. I also have a define block for each of the solutions.
<cb:define name="ProductBuildProject">
<project name="$(ProjectName)" queue="Common">
<category>Main Builds</category>
<sourcecontrol type="multi">
<sourceControls>
<cb:svn-sourcebuild-checkout BranchPath="$(BranchPath)" MainSourcePath="$(MainSourcePath)" />
</sourceControls>
</sourcecontrol>
<modificationDelaySeconds>10</modificationDelaySeconds>
<labeller type="defaultlabeller">
<prefix><cb:LabelPrefix/></prefix>
<incrementOnFailure>true</incrementOnFailure>
</labeller>
<triggers>
<intervalTrigger name="continuous" seconds="900" buildCondition="IfModificationExists"/>
</triggers>
<tasks>
<nant>
<executable>&nant-path;</executable>
<baseDirectory><cb:LocalKeywordLabPath/>\<cb:MainSourcePath/></baseDirectory>
<buildArgs>-v -D:deployServer=<cb:DeployServer/></buildArgs>
<buildFile><cb:BuildFileName/></buildFile>
<targetList>
<target><cb:BuildTargetName/></target>
</targetList>
<buildTimeoutSeconds>600</buildTimeoutSeconds>
</nant>
</tasks>
<publishers>
<merge>
<files>
<file><cb:LocalKeywordLabPath/>\<cb:MainSourcePath/>\<cb:UnitTestOutputPath/></file>
</files>
</merge>
&publishers-common-block;
</publishers>
<externalLinks/>
</project>
</cb:define>
<cb:define name="TrunkBuildParameters">
<cb:define name="LocalKeywordLabPath"><cb:keywordlab-trunk-local/></cb:define>
<cb:define name="BranchPath"><cb:trunk-path/></cb:define>
<cb:define name="LabelPrefix">1.1.0.</cb:define>
<cb:define name="DeployServer">smwtlkwlab01n</cb:define>
</cb:define>
<cb:define name="ReleaseBranchBuildParameters">
<cb:define name="LocalKeywordLabPath"><cb:keywordlab-release-local/></cb:define>
<cb:define name="BranchPath"><cb:releaseBranch-path/></cb:define>
<cb:define name="LabelPrefix">1.1.100.</cb:define>
<cb:define name="DeployServer">smwdvkwlab03n</cb:define>
</cb:define>
<cb:define name="KeywordLabWebParameters">
<cb:define name="MainSourcePath">Source\Presentation</cb:define>
<cb:define name="BuildFileName">KeywordLab.Web.build</cb:define>
<cb:define name="BuildTargetName">automated-with-webdeploy</cb:define>
<cb:define name="UnitTestOutputPath">KeywordLab.Web.UnitTest\bin\Release\KeywordLab.Web.UnitTest.trx</cb:define>
</cb:define>
<cb:define name="KeywordLabWebMvcParameters">
<cb:define name="MainSourcePath">Source\UI</cb:define>
<cb:define name="BuildFileName">KeywordLab.Web.Mvc.build</cb:define>
<cb:define name="BuildTargetName">automated-with-webdeploy</cb:define>
<cb:define name="UnitTestOutputPath">KeywordLab.Web.Mvc.Tests\bin\Release\KeywordLab.Web.Mvc.Tests.trx</cb:define>
</cb:define>
<cb:define name="KeywordLabServiceParameters">
<cb:define name="MainSourcePath">Source\Service</cb:define>
<cb:define name="BuildFileName">KeywordLab.build</cb:define>
<cb:define name="BuildTargetName">automated</cb:define>
<cb:define name="UnitTestOutputPath">KeywordLab.UnitTest\bin\Release\KeywordLab.UnitTest.trx</cb:define>
</cb:define>
Finally, I try to define the 6 projects each by referencing the define block for the trunk or release build and the correct define block for the solution.
<!--KeywordLab Web-->
<cb:ProductBuildProject>
<cb:define name="ProjectName">KeywordLab Web (1N)</cb:define>
<cb:TrunkBuildParameters/>
<cb:KeywordLabWebParameters/>
</cb:ProductBuildProject>
<!--KeywordLab Web Mvc-->
<cb:ProductBuildProject>
<cb:define name="ProjectName">KeywordLab Web Mvc (1N)</cb:define>
<cb:TrunkBuildParameters/>
<cb:KeywordLabWebMvcParameters/>
</cb:ProductBuildProject>
<!--KeywordLab Service-->
<cb:ProductBuildProject>
<cb:define name="ProjectName">KeywordLab Service (1N)</cb:define>
<cb:TrunkBuildParameters/>
<cb:KeywordLabServiceParameters/>
</cb:ProductBuildProject>
<!--KeywordLab Web-->
<cb:ProductBuildProject>
<cb:define name="ProjectName">Release Branch (3N) - KeywordLab Web</cb:define>
<cb:ReleaseBranchBuildParameters/>
<cb:KeywordLabWebParameters/>
</cb:ProductBuildProject>
<!--KeywordLab Web Mvc-->
<cb:ProductBuildProject>
<cb:define name="ProjectName">Release Branch (3N) - KeywordLab Web Mvc</cb:define>
<cb:ReleaseBranchBuildParameters/>
<cb:KeywordLabWebMvcParameters/>
</cb:ProductBuildProject>
<!--KeywordLab Service-->
<cb:ProductBuildProject>
<cb:define name="ProjectName">Release Branch (3N) - KeywordLab Service</cb:define>
<cb:ReleaseBranchBuildParameters/>
<cb:KeywordLabServiceParameters/>
</cb:ProductBuildProject>
This isn't working and I'm hoping that someone can point out what I'm doing wrong. When I try to load this config, the error I receive is:
[CCNet Server:ERROR] INTERNAL ERROR: Reference to unknown symbol LabelPrefix
As you can see in TrunkBuildParameters and ReleaseBranchBuildParameters, I define LabelPrefix in both, and all 6 projects reference one or the other of these define blocks. I then try to reference this in the block of the project. This is apparently not a valid way of defining a variable for use by projects. Could someone please tell me what I'm doing wrong or perhaps a better way to do this at all?