2013-04-12 12 views
2

我正在CCNet版本1.4中工作,我很难获得我想要的干净方式定义的参数。在我的例子中,我需要6个总项目(2个分支中的3个解决方案)。我定义了一个通用项目,该项目可以根据8个变量的选择合并所有6种可能性。当它是一个主干项目时,其中4个变量应该是一件事。当它是一个分支项目时,这4个变量应该是另一回事。其他4个变量取决于我想要构建的解决方案。如何在CCNet中设置定义多个参数?

在我下面的尝试中,我将4个主干变量放在一个定义块中,并将4个释放变量放在另一个块中。我也为每个解决方案定义了一个块。

<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> 

最后,我试图通过引用定义块为主干或发布版本定义的6个项目和每一个正确的定义块的解决方案。

<!--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> 

这是行不通的,我希望有人能指出我做错了什么。当我尝试加载这个配置,我收到的错误是:

[CCNet Server:ERROR] INTERNAL ERROR: Reference to unknown symbol LabelPrefix 

正如你在TrunkBuildParameters和ReleaseBranchBuildParameters看,我都定义LabelPrefix,所有6个项目引用一个或其他的这些定义块。然后我尝试在项目的块中引用它。这显然不是定义供项目使用的变量的有效方式。有人能告诉我我做错了什么,或者更好的方法来做到这一点?

+0

您不能使用语法来cb:定义一组参数,显然没有办法做到这一点。但是,您可以诉诸使用包含文件。 –

+0

稍微偏离主题,&nant-path;界定? – granadaCoder

+0

它是我们所有CCNet文件使用的通用定义文件的一部分。 – user779860

回答

0

我建议使用Cruisecontrol提供的Validator来查看最终解析的配置文件是什么,以检查是否遗漏了任何东西。

话虽如此,我通常做的是相反的方式。我定义了常用的配置块,然后用几行写出项目配置。也许你会认为这够干净?

相关问题