Hudson 与 Subversion:使用 Java 或 Ant 在 Windows 上提交后构建
我的任务是让 Hudson 在提交后开始新的构建。正如我在此处阅读的那样,它是通过使用 svn post-commit 完成的钩。问题是我不想使用 VBScript,因此它依赖于平台。正如我所看到的,此 VBScript 中唯一重要的事情是使用 svnlook 命令和 http://server/subversion/${UUID}/notifyCommit?rev=$REV url 。就我而言,我可以做同样的事情,例如使用一个java程序(它需要修订版、存储库位置等参数)。
请您解开http:// /server/subversion/${UUID}/notifyCommit?rev=$REV 网址?我需要所有可能的变体。如果有人可以描述与 Hudson 交互的整个过程(它是在收到此请求后执行的内部流程链),那就太好了
编辑我真的需要提交后行为,而不是轮询机制。
My task is to make Hudson starting a new build after a commit. As I've read here it is done by using svn post-commit hook. The problem is I don't want to use VBScript so that is is platform-dependent. As I can see the only important things in this VBScript are using svnlook command and http://server/subversion/${UUID}/notifyCommit?rev=$REV url. As far as I am concerned I can do the same thing just using, for example, a java program (which requires parameters as revision, repository location, etc.)
Can you, please, unravel the mystery of the http://server/subversion/${UUID}/notifyCommit?rev=$REV url? I need all possible variants. It would be great if sombody can describe the whole process of interaction with Hudson (it's internal processes' chain which execute after it gets this request)
EDIT I really need the post-commit behavior, not a polling mechanism.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
最快的跨平台解决方案是在 SVN 服务器上安装 Cygwin(假设 SVN 机器运行 Windows)并使用提供的 shell 脚本:
为什么?那一个可以满足您的所有需求。
您也可以使用提交后挂钩中的某些内容来 ping:
http://YOURHOST/jenkins/job/PROJECTNAME/build
。您不会为每个提交获得一个新的构建,但是如果您在几秒钟之内有两次提交,您真的想要每次构建吗?只是出于好奇,您是否想要后期提交,因为您发现 SVN 服务器变得非常慢?如果是的话,SVN 盒子运行在什么操作系统上?您可能会遇到操作系统的限制,如果您迁移到 Linux 或 Windows 服务器版本,您将获得更好的性能(在相同情况下)。
The quickest, cross platform solution is to install Cygwin on the SVN server (assuming the SVN box is running Windows) and use the suppiled shell script:
Why? That one does all you need.
You could also just use something in the post-commit hook to ping:
http://YOURHOST/jenkins/job/PROJECTNAME/build
. You will not get a fresh build for every commit, but if you have two commits within seconds of each other do you really want each built?Just out of curiosity, do you want the post commit as you have found your SVN server getting incredibly slow? If so, what OS is the SVN box on? You might be hitting limits of the OS and you would get much better performance (on the same tin) if you moved to Linux or a server edition of Windows.
您不一定需要使用 svn hook。只需让 Hudson 经常轮询存储库以了解更改即可。此外,您可能需要使用一个安静期来考虑连续的多个提交(否则可能会触发多个构建)。
从您发布的链接:
我不认为等待一分钟有那么大的问题。在大多数情况下,您甚至可能没有注意到它。
You don't necessarily need to use a svn hook. Just make Hudson poll the repo for changes frequently. Additionally you might want to employ a quiet period in order to account for multiple commits in a row (which otherwise might trigger multiple builds).
From the link you posted:
I wouldn't consider having to wait a minute that big a problem. In most cases you might not even notice it.
我是这样做的:我将 hudson 配置为每分钟检查一次更改(模式:* * * * *)。效果非常好。唯一可能发生的问题是,如果在此时间间隔内提交的两个项目相互依赖,那么 hudson 首先会构建错误的项目。
I've done it like this: I configured hudson to check every minute for changes (Pattern: * * * * *). It works quite good. The only problem which can occur is that if two projects which have been commited within this interval and are dependent on each other, that hudson builds the wrong one first.
重要提示 - 网络上的文章都没有明确提到您必须在选中“触发远程构建”的情况下创建的作业。这是第一步,此步骤本身为您提供了必须放入 subversion HOOK 脚本中的 URL
相应的钩子脚本
!/bin/sh
Important - None of the article on web clearly mentions about the job that you have to create with "Trigger Build Remotely" checked. This is the first step and this step itself gives you URL that you have to put in your subversion HOOK script
corresponding hook script
!/bin/sh