Hudson 可以配置为构建每个修订版吗?
我已经开始尝试使用 Hudson 作为构建服务器。 我正在使用 subversion 并将其配置为每分钟轮询一次。 我看到的问题是,如果修订版 10 的构建需要 5 分钟,并且在此期间有 5 次提交,Hudson 接下来将构建修订版 15。
有没有办法确保构建每个修订版?
I've started experimenting with Hudson as a build server. I'm using subversion and have it configured to poll every minute. The issue I'm seeing is that if a build at revision 10 takes 5 minutes and there are 5 commits during that time, Hudson will next build revision 15.
Is there a way to ensure every revision is built?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您必须执行一些操作才能准确构建每个修订版:
REVISION
字符串参数${REVISION}
参数附加到存储库 URL,例如: https://server/path/myproject${REVISION}
REVISION
变量仅在 URL 中展开,但在创建文件夹时,Hudson 不会展开它,从而产生一个名为:myproject${REVISION}
的文件夹,<代码>
/usr/bin/wget \
--auth-no-challenge \
--无检查证书 \
--用户=我\
--密码=mypasswd \
https://server/path/job/jobname/buildWithParameters?delay=0sec\&REVISION=%40$REV \
-O /dev/空
如果你想手动触发构建,你有两种可能性:
@
符号非常重要,因为所有这些技巧都依赖于 Subversion 插件将URL@NNN
解释为从 URL 的存储库获取修订版 NNN
。 如果您忘记了@
,Subversion 只会说找不到文件夹https://server/path/myprojectNNN
。 这也是为什么你必须在 wget 命令中的REVISION=
和$REV
之间放置%40
,%40
是@
的转义字符。You have to do a few things to build exactly each revision:
REVISION
string parameter to your job${REVISION}
parameter to the repository URL,e.g.:
https://server/path/myproject${REVISION}
REVISION
variable is only expanded in the URL, but when creating the folder, Hudson will not expand it, resulting in a folder named:myproject${REVISION}
/usr/bin/wget \
--auth-no-challenge \
--no-check-certificate \
--user=me \
--password=mypasswd \
https: //server/path/job/jobname/buildWithParameters?delay=0sec\&REVISION=%40$REV \
-O /dev/null
If you want to trigger a build manually, you have two possibilities:
The
@
sign is very important because all this trick relies on the fact that Subversion plugin interpretsURL@NNN
asget revision NNN from repository at URL
. If you forget the@
, Subversion will just say it can't find folderhttps://server/path/myprojectNNN
. That's also why you have to put%40
betweenREVISION=
and$REV
in the wget command,%40
is the escaped character for@
.我采用了上面的 fchateaus 方法(谢谢!),并将其修改为与 Mercurial 一起使用。
您将需要在中央服务器上编辑 .hg/hgrc,并放入变更组挂钩。 请记住,变更组仅将第一个变更集设置为 HG_NODE 环境变量,因此您必须执行 hg Tip 来获取真正的提示节点并通过 URL 传递它。 一句台词里有一点技巧,但我想通了。
这就是您为在 Windows 上运行的 Hudson 所做的事情。
I took fchateaus approach above (thanks man!) and modified it to work with Mercurial.
You will need to edit .hg/hgrc on the central server, and put in a changegroup hook. Keep in mind that changegroups only set the first changeset to the HG_NODE environment variable, so you have to do a hg tip to grab the real tip node and pass that along via URL instead. A bit of a trick to do in a one-liner, but I figured it out.
This is what you would do for Hudson running on Windows.
。 您可以单击“立即构建”触发构建三次,并将构建参数保留为“空”。 您将看到 Hudson 队列中只有前两个构建。 第三个将被忽略:P酷,但它真的很糟糕,它在某些文档中没有找到,但在我的多次实验中:(
e.g. you can click "Build Now" to trigger build for three times and just leave the build para as "null". you will see only first two builds are in Hudson queue. The third one will be ignored :P cool but it's really bad that it's not found in some document but with my experiments for times :(
在构建配置的 SCM 部分中,您应该有“构建触发器”部分和选项“触发器远程构建(例如,从脚本)”。 根据该选项旁边的帮助信息,您可以编写提交后操作的脚本,以便每次提交都会触发新的构建。 由于 hudson 有构建队列,因此您应该构建每个修订版本。
这是一个可以帮助您的链接:https://hudson.dev.java.net/build。 :
下面是如何使用参数开始构建作业的示例(有关详细信息,请参阅我的评论)
http://wiki.hudson-ci.org/display/HUDSON/Parameterized+构建
In SCM part of build configuration you should have Build Triggers section and option "Trigger builds remotely (e.g., from scripts)". According to help info next to that option you can script post-commit action so every commit would fire new build. As hudson has build's queue you should have every revision built.
Here's a link that could help you: https://hudson.dev.java.net/build.html
Here's example how to start build job with parameters (see to my comment for details):
http://wiki.hudson-ci.org/display/HUDSON/Parameterized+Build
Hudson 尚不具备此功能,但邮件列表中已多次要求提供此功能。 请参阅问题 673
Hudson does not yet have this capability, but its been asked for a few times on the mailing list. See issue 673