如何使用 CruiseControlNet 将集成属性传递到批处理文件?

发布于 2024-08-28 03:45:39 字数 1418 浏览 7 评论 0原文

在我的项目的构建日志中,我可以看到这些属性:

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

我想将属性CCNetProjectLastChangeNumber传递到批处理文件。 它与CCNetProject配合良好,因为它可以在批处理中用作环境变量%CCNetProject%

但它不适用于其他属性(那些不以 CCnet 前缀开头的属性)如 LastChangeNumberLastModificationDate

我试图将其作为参数传递,但失败了!

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

我尝试将其作为环境变量传递,但失败了:

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

当我显示参数或变量时,结果始终相同:空字符串或变量名称 $(svn_label)

我确信它是简单,但是...我找不到!有什么想法吗?

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 ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

岁月无声 2024-09-04 03:45:39

CCNET 将以下参数传递给外部程序:

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

如您所见,LastIntegrationStatus eg 可通过 CCNetLastIntegrationStatus 获得,但 LastModificationDate eg 没有等效项。

您可以通过 传递其他参数,但在内部 CCNET 配置中您无权访问 关于上面提到的集成属性。大多数从 CCNET 开始的人(包括我自己)都会尝试类似 $(CCNetProject) 的东西,但都会失败。

看看我的对类似问题的回答。

抱歉我无法提供更好的解决方案。

更新(关于思考者的建议 ):

在 CCNET 配置中使用 $[$CCNetLabel] 似乎不起作用。

坦白说,如果有的话,我会感到相当惊讶。配置是静态的,而 CCNetLabel 是动态的,可能会随着每个集成构建而变化。假设您可以访问配置中的这些动态属性,则配置可能会随着每次构建而改变。由于更改配置意味着自动重新启动 CCNET 服务器,因此每次构建都会导致服务器重新启动。实际上这并不是一种理想的行为,不是吗?

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?

清风不识月 2024-09-04 03:45:39

好的,找到了解决方案。
需要使用名为 SvnRevisionLabeller 的特定标签来检索 svn 修订版。
然后可以通过 CCNetLabel 环境变量使用它。

http://code.google.com/p/svnrevisionlabeller/

<labeller type="svnRevisionLabeller"> 
  <url>http://mysvnrootproject/trunk</url> 
</labeller>

ok, found the solution.
Need to use a specific label called SvnRevisionLabeller to retrieve the svn revision.
it is then available via the CCNetLabel environement variable.

http://code.google.com/p/svnrevisionlabeller/

<labeller type="svnRevisionLabeller"> 
  <url>http://mysvnrootproject/trunk</url> 
</labeller>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文