我可以让 Hudson 在一天内只构建一次吗? (但不是在特定时间)
目前,我正在使用 Hudson CI 每 5 分钟就 SCM 更改构建一个中型项目。我想进一步推动它的使用,并让它进行正确的每日/夜间构建(目前 CI 没有对产品做任何事情,它仅用于单元测试)
但是,问题CI 服务器不是在专用的盒子上运行 - 它实际上是一台在一天中大部分时间都处于运行状态的机器,但最终会关闭(它也不会在可预测的开始->结束时间跨度内打开)
所以我只会将 @daily 粘贴到 Hudson 中,但据我所知,这是在午夜构建的,此时机器很可能不会打开。
有什么方法可以让 hudson 每天执行一次构建,但不是在特定时间执行?例如,我可以在 hudson 启动时立即触发它,或者类似的事情吗?
谢谢
At the moment I'm using the Hudson CI to build a medium sized project every 5 minutes on SCM change. I'd like to push the use of it out a bit further, and get it doing proper daily/nightly builds (at the moment the CI isn't doing anything with the products, its there for unit testing only)
However, the problem is the CI server isn't run on a dedicated box - it's actually a machine that's up for most of the day, but does eventually turn off (it isn't on for a predictable start->end time span either)
So I would just stick @daily into Hudson, but from what I can tell, this builds at midnight, when there's a very high chance the machine won't even be on.
Is there any way I can get hudson to perform a single build every day, but not at a specific time? e.g. Can I somehow trigger it as soon as hudson starts, or something along those lines?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以使用 CLI 插件从外部控制 Hudson 进程。
然后,您可以围绕它编写所需的任何内容,例如将其放入“每小时运行”的 cron 脚本中,在其中跟踪构建的最后一次调用,以便您可以确定何时再次启动构建。
You can use the CLI plugin to externally control the Hudson process.
You can then script whatever you need around it, like putting it in a "run every hour" cron script in where you keep track of the last invocation of the build, so you can determine when you want to launch the build again.
你使用 ANT 来构建你的类吗?在这种情况下,您可以在 ant 构建文件中实现“每天一次”功能。
在构建时将日期写入文件,并且仅当今天不是该日期时才构建。 (使用 tstamp 和 condition 任务)
在这种情况下,Hudson 仍然会每 5 分钟检查一次,如果 ant 确定今天的构建有,它就会跳过构建过程已经做了。
我猜您可以使用其他构建工具创建类似的解决方案。
Do you use ANT to build your classes? In that case you could implement the 'once a day' functionality inside your ant build file.
Write the date to a file on build, and only build if today is not that date. (Using tstamp and condition tasks)
In this scenario Hudson would still check every 5 minutes, and ant would just skip the build process if it determines the build for today has already been made.
I'm guessing you can create a similar solution using other build tools.
Hudson 插件存储库有一个用于在 Hudson 启动时启动构建的插件:
http://wiki.hudson-ci.org/display/HUDSON/Startup+Trigger
通过“管理 Hudson”页面安装插件,并在您想要在启动时构建的每个作业上启用触发器。
如果您每天都重新启动计算机,它可能会提供您想要的东西。
The Hudson plugin repository has a plugin for starting builds when Hudson is started up:
http://wiki.hudson-ci.org/display/HUDSON/Startup+Trigger
Install the plugin through the "Manage Hudson" page, and enable the trigger on each job you want to build on start up.
If you're rebooting the machine every day, it might provide what you want.