CruiseControl.NET:在ccnet.config文件中使用$(CCNetLabel)

min*_*nty 21 cruisecontrol.net ccnet-config

调用MSBuild巡航控件等外部进程时设置环境变量.其中一个值是CCNetLabel.它保留了当前项目标签的价值.我想在ccnet配置本身使用相同的值但是当我尝试ccnet配置有问题时.我收到以下错误:

[CCNet Server:ERROR] INTERNAL ERROR: Reference to unknown symbol CCNetLabel
----------
ThoughtWorks.CruiseControl.Core.Config.Preprocessor.EvaluationException: Reference to unknown symbol CCNetLabel
at ThoughtWorks.CruiseControl.Core.Config.Preprocessor.ConfigPreprocessorEnvironment._GetConstantDef(String name)
at ThoughtWorks.CruiseControl.Core.Config.Preprocessor.ConfigPreprocessorEnvironment.eval_text_constant(String name)

.....

----------
Run Code Online (Sandbox Code Playgroud)

我实际上想将CCNetLabel附加到另一个变量,所以我需要访问ccnet.config中的属性.

是否有不同的方式来引用这些变量?

Dar*_*ryl 21

我们也需要这样做,并发现我们可以使用CruiseControl.NET 1.5中引入的Replacement Dynamic Values从ccnet.config中访问CCNetLabel.

例如,此代码段中的dynamicValues块:

  <buildpublisher>
    <sourceDir>C:\ccnet_projects\Installer\bin\x86\Release</sourceDir>
    <dynamicValues>
      <replacementValue property="publishDir">
        <format>C:\builds\installers\{0}\x86</format>
        <parameters>
          <namedValue name="$CCNetLabel" value="Default" />
        </parameters>
      </replacementValue>
    </dynamicValues>
    <useLabelSubDirectory>false</useLabelSubDirectory>
  </buildpublisher>
Run Code Online (Sandbox Code Playgroud)

生成包含动态CCNetLabel值的publishDir路径:

  <buildpublisher>
    <sourceDir>C:\ccnet_projects\Installer\bin\x86\Release</sourceDir>
    <publishDir>C:\builds\installers\1.0.2.120\x86</publishDir>
    <useLabelSubDirectory>false</useLabelSubDirectory>
  </buildpublisher>      
Run Code Online (Sandbox Code Playgroud)

(请注意,对于此特定示例,useLabelSubDirectory设置为false以避免将CCNetLabel附加到publishDir路径.)


Thi*_*ker 15

以下内容可以在ccnet 1.5版的配置文件中使用<cb:define buildversion ="$ [ $ CCNetLabel ]"/>


小智 9

我认为Darryl的答案是在CCNET 1.5中解决这个问题的最佳方法.关于答案的两条评论:

  • 这是关于动态参数的 ccnet文档的正确链接.
  • 正如您可以在文档中阅读的那样,有一条快捷方式可以使用语法获取您正在寻找的集成属性的值$[$Integration_Property].在你的情况下,使用$[$CCNetLabel]会工作.


The*_*man 5

无法在CCNET配置中访问这些环境变量.我想几乎任何配置CCNET(包括我自己)的人都试图这样做.此功能经常被要求,但尚未实施.

如果您想要访问CCNetWorkingDirectoryCCNetArtifactDirectory有解决方法:

<cb:define name="project.workingDirectory">c:/foo</cb:define>
<cb:define name="project.artifactDirectory">c:/bar</cb:define>
<project>
  <workingDirectory>$(project.workingDirectory)</workingDirectory>
  <artifactDirectory>$(project.artifactDirectory)</artifactDirectory>
  ...
</project>
Run Code Online (Sandbox Code Playgroud)

但我不知道访问的解决方案CCNetLabel.对不起,我没有更好的消息.


Ada*_*ger 5

以下文章应该能够帮助您.您可以cb:scope在a中使用或定义整个项目,cb:define并传递项目名称.

-祝好运-

http://confluence.public.thoughtworks.org/display/CCNET/Configuration+Preprocessor

http://ferventcoder.com/archive/2009/05/21/uppercut---automated-builds---cruisecontrol.net-integration.aspx