visual-studio 预构建任务 - 删除 CruiseControl.NET 中的工作副本

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8127/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 16:21:16  来源:igfitidea点击:

Pre-build task - deleting the working copy in CruiseControl.NET

visual-studiocontinuous-integrationcruisecontrol.netvisualsvn-server

提问by David A Gibson

I'm currently in the process of setting up a continuous integration environment at work. We are using VisualSVN Server and CrusieControl.NET. Occasionally a build will fail and a symptom is that there are conflicts in the CruiseControl.NET working copy. I believe this is due to the way I've setup the Visual Studio solutions. Hopefully the more projects we run in this environment the better our understanding of how to set them up will be so I'm not questioning why the conflicts happen at this stage. To fix the builds I delete the working copy and force a new build - this works every time (currently). So my questions are: is deleting the working copy a valid part of a continuous integration build process, and how do I go about it?

我目前正在设置工作中的持续集成环境。我们正在使用 VisualSVN 服务器和 CrusieControl.NET。有时,构建会失败,症状是 CruiseControl.NET 工作副本中存在冲突。我相信这是由于我设置 Visual Studio 解决方案的方式。希望我们在这种环境中运行的项目越多,我们对如何设置它们的理解就会越好,所以我不会质疑为什么会在这个阶段发生冲突。为了修复构建,我删除了工作副本并强制进行新构建 - 这每次都有效(当前)。所以我的问题是:删除工作副本是否是持续集成构建过程的有效部分,我该怎么做?

I've tried solutions including MSTask and calling delete from the command line but I'm not having any luck.

我已经尝试过包括 MSTask 和从命令行调用 delete 在内的解决方案,但我没有任何运气。

Sorry for being so wordy - good job this is a beta :)

很抱歉这么啰嗦 - 干得好,这是一个测试版:)

回答by Jamie

Doing a full delete before or after your build is good practice. This means that there is no chance of your build environment picking up an out of date file. Your building exactly against what is in the repository.

在构建之前或之后进行完全删除是一种很好的做法。这意味着您的构建环境不可能选择过时的文件。您的构建完全针对存储库中的内容。

Deleting the working copy is possible as I have done it with Nant.

删除工作副本是可能的,因为我已经用 Nant 完成了。

In Nant I would have a clean script in its own folder outwith the one I want to delete and would then invoke it from CC.net.

在 Nant 中,我会在自己的文件夹中有一个干净的脚本,而不是我想删除的那个,然后从 CC.net 调用它。

I assume this should also be possible with a batch file. Take a look at the rmdir command http://www.computerhope.com/rmdirhlp.htm

我认为这也应该可以通过批处理文件实现。看看rmdir命令http://www.computerhope.com/rmdirhlp.htm

@pauldoo

@pauldoo

I prefer my CI server to do a full delete as I don't want any surprise when I go to do a release build, which should always be done from a clean state. But it should be able to handle both, no reason why not

我更喜欢我的 CI 服务器进行完全删除,因为当我进行发布构建时我不希望有任何意外,这应该始终在干净的状态下完成。但它应该能够处理两者,没有理由不

回答by Joe Schneider

@jamie: There is one reason why you may not be able to do a clean build every time when using a continuous integration server -- build time. On some projects I've worked on, clean builds take 80+ minutes (an embedded project consisting of thousands of C++ files to checkout and then compile against multiple targets). In this case, you have to weigh the benefit of fast feedback against the likelihood that a clean build will catch something that an incremental build won't. In our case, we worked on improving and parallelizing the build process while at the same time allowing incremental builds on our CI machine. We did have a few problems because we weren't doing clean builds, but by doing a clean build nightly or weekly you could remove the risk without losing the fast feedback of your CI machine.

@jamie:在使用持续集成服务器时,您可能无法每次都进行干净的构建有一个原因——构建时间。在我参与过的一些项目中,干净的构建需要 80 分钟以上(一个包含数千个 C++ 文件的嵌入式项目要检出,然后针对多个目标进行编译)。在这种情况下,您必须权衡快速反馈的好处与干净构建会捕获增量构建不会捕获的东西的可能性。在我们的案例中,我们致力于改进和并行化构建过程,同时允许在我们的 CI 机器上进行增量构建。我们确实遇到了一些问题,因为我们没有进行干净的构建,但是通过每晚或每周进行一次干净的构建,您可以消除风险而不会丢失 CI 机器的快速反馈。

回答by Alex

If you check out CC.NET's jirathere is a patch checked in to implement CleanCopy for Subversion which does exactly what you want and just set CleanCopy equal to true inside your source control block just like with the TFS one.

如果你查看 CC.NET 的jira,就会有一个补丁被签入来为 Subversion 实现 CleanCopy,它完全符合你的要求,只需在你的源代码控制块中将 CleanCopy 设置为等于 true,就像使用 TFS 块一样。

回答by Brad Barker

It is very common and generally a good practice for any build process to do a 'clean' before doing any significant build. This prevents any 'artifacts' from previous builds to taint the output.

对于任何构建过程来说,在进行任何重要构建之前进行“清理”是非常普遍的,并且通常是一种很好的做法。这可以防止来自先前构建的任何“工件”污染输出。

A clean is essentially what you are doing by deleting the working copy.

清理本质上是您通过删除工作副本来执行的操作。

回答by pauldoo

@Brad Barker

@布拉德·巴克

Clean means to just wipe out build products.

清洁意味着只是清除构建产品。

Deleting the working copy deletes everything else too (source and project files etc).

删除工作副本也会删除其他所有内容(源文件和项目文件等)。

In general it's nice if you're build machine can operate without doing a full delete, as this replicates what a normal developer does. Any conflicts it finds during update are an early warning to what your developers can expect.

一般来说,如果您的构建机器可以在不进行完全删除的情况下运行,那就太好了,因为这复制了普通开发人员所做的事情。它在更新期间发现的任何冲突都是对您的开发人员可以期望的早期警告。



@jamie

@杰米

For formal releases yes it's better to do a completely clean checkout. So I guess it depends on the purpose of the build.

对于正式版本,是的,最好进行完全干净的结帐。所以我想这取决于构建的目的。