如何仅在特定任务结束后运行 CruiseControl.NET 任务?

发布于 2024-08-10 14:15:09 字数 170 浏览 5 评论 0原文

例如我有三个任务:task1、task2、task3。如何编写一个 CruiseControl.NET 配置文件来运行任务 3,但仅在任务 2 成功结束后运行?

For example I have three tasks: task1, task2, task3. How to write a CruiseControl.NET configuration file that runs task3 but only after task2 ends with success?

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

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

发布评论

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

评论(4

听,心雨的声音 2024-08-17 14:15:09

CruiseControl.NET v1.5 使用新的顺序和并行任务增强了任务的执行...

http://confluence.public.thoughtworks.org/display/CCNET/Sequential+Task

<sequential continueOnFailure="false">
  <description>Example of how to run multiple tasks in sequence.</description>
  <tasks>
    <!-- Tasks defined here -->
  </tasks>
</sequential>

CruiseControl.NET v1.5 enhances the execution of tasks using their new Sequential and Parallel tasks...

http://confluence.public.thoughtworks.org/display/CCNET/Sequential+Task

<sequential continueOnFailure="false">
  <description>Example of how to run multiple tasks in sequence.</description>
  <tasks>
    <!-- Tasks defined here -->
  </tasks>
</sequential>
少年亿悲伤 2024-08-17 14:15:09

根据您想要完成的任务,可以通过两种方式轻松完成:

A) CruiseControl.NET 支持所谓的 projectTriggers

为了使用此方法,每个任务都需要隔离到自己的项目配置中。基本上,task3 项目 监视task2 项目 的构建状态。当task2 项目成功完成时,task3 项目将触发构建。要设置 projectTrigger,请在 ccnet.config 中编辑 task3 项目 定义并创建触发器块,如下所示:

<triggers>
  <multiTrigger>
    <triggers>
      <intervalTrigger seconds="30" />
      <projectTrigger project="task2">
        <triggerStatus>Success</triggerStatus>
      </projectTrigger>
    </triggers>
  </multiTrigger>
</triggers>

B) 使用 Nant 目标设置任务的顺序:

As Wim 指出,您可能需要考虑将任务分解为 Nant 目标,而不是尝试在 ccnet.config 中执行。就我个人而言,我发现这种方法更舒服,只是因为我知道 Nant 擅长做这类事情。

Depending on what you are trying to accomplish, this can be done pretty easily in 2 ways:

A) CruiseControl.NET supports what is referred to as projectTriggers:

In order to use this approach, each task needs to be isolated into their own project configuration. Basically, the task3 project monitors the build status of the task2 project. When the task2 project successfully completes, the task3 project triggers a build. To setup a projectTrigger, edit your task3 project definition in ccnet.config and create a trigger block as follows:

<triggers>
  <multiTrigger>
    <triggers>
      <intervalTrigger seconds="30" />
      <projectTrigger project="task2">
        <triggerStatus>Success</triggerStatus>
      </projectTrigger>
    </triggers>
  </multiTrigger>
</triggers>

B) Setup the order of your tasks using Nant targets instead:

As pointed out by Wim, you may want to consider breaking the tasks out into Nant targets instead of trying to do it in the ccnet.config. Personally, I find this approach more comfortable only because I know Nant is good at doing just this sort of thing.

挽清梦 2024-08-17 14:15:09

我建议您在 NAnt 或 MSBuild 任务中执行此操作,并将其移出您的 CruiseControl.NET 配置。

你的任务是做什么的?您无法将它们移动到 NAnt 或 MSBuild 脚本中的原因是什么?

I'd suggest you do that inside your NAnt or MSBuild task instead, and move it out of your CruiseControl.NET configuration.

What do your tasks do? Any reason you can't move them inside your NAnt or MSBuild script?

淡淡の花香 2024-08-17 14:15:09

我会推荐一个脚本文件(bat,PowerShell),您可以在其中运行任务并检查是否成功。

I would recommend a script file (bat, PowerShell) where you run the tasks and check for success.

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