如何仅在特定任务结束后运行 CruiseControl.NET 任务?
例如我有三个任务: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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
CruiseControl.NET v1.5 使用新的顺序和并行任务增强了任务的执行...
http://confluence.public.thoughtworks.org/display/CCNET/Sequential+Task
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
根据您想要完成的任务,可以通过两种方式轻松完成:
A) CruiseControl.NET 支持所谓的 projectTriggers:
为了使用此方法,每个任务都需要隔离到自己的项目配置中。基本上,task3 项目 监视task2 项目 的构建状态。当task2 项目成功完成时,task3 项目将触发构建。要设置 projectTrigger,请在 ccnet.config 中编辑 task3 项目 定义并创建触发器块,如下所示:
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:
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.
我建议您在 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?
我会推荐一个脚本文件(bat,PowerShell),您可以在其中运行任务并检查是否成功。
I would recommend a script file (bat, PowerShell) where you run the tasks and check for success.