简体   繁体   English

如何使用与hudson相同的svn修订版号构建许多项目?

[英]How to build many projects with the same svn revision number with hudson?

I'm just starting with hudson and I'd like to build my projects like my handmade solution did before: 我只是从哈德森开始,我想像我以前做过的手工解决方案一样构建我的项目:

  1. Retrieve the current svn revision number rev . 检索当前的svn修订号rev
  2. Build all projects (each with individual result) with the revision number rev . 使用版本号rev构建所有项目(每个项目都有单独的结果)。
  3. Start again with step 1 regardless if there were any changes in the meantime (to detect nondeterministic errors that don't occur on every test run). 无论同时是否有任何更改(检测每次测试运行中未发生的非确定性错误),都要从步骤1重新开始。

How can I configure this with hudson ? 如何使用hudson配置它?

Just to extend the sjohnston post. 只是为了扩展sjohnston帖子。 Instead of checking the code out to a known location, you can use the Clone Workspace SCM Plugin . 您可以使用Clone Workspace SCM插件 ,而不是将代码检查到已知位置。 Now you can reference the checkout from the first job. 现在您可以参考第一份工作的结账。

In addition you can just pass around the revision number and pass it as a parameter to your build jobs. 此外,您只需传递修订号,并将其作为参数传递给构建作业。 The build jobs can than retrieve the right version of code by using the revision number. 构建作业可以使用修订号来检索正确的代码版本。

Hudson doesn't really have good support for making a single SVN check-out and then using it for several different jobs. Hudson并没有真正支持单个SVN签出然后将其用于几个不同的工作。

You could try this: 你可以试试这个:

  • Set up a job that just does the check-out to a known directory. 设置一个只签出已知目录的作业。 Check the post-build-actions > build other projects box and add all the build jobs. 检查post-build-actions>构建其他项目框并添加所有构建作业。
  • Set up each of the build jobs to copy over the latest check-out from wherever the first job placed it. 设置每个构建作业,以便从第一个作业放置的任何位置复制最新的签出。 Have these set up to build periodically so they will continue to build even when there are no check-ins happening. 将这些设置为定期构建,以便即使没有签入也会继续构建。
  • Possibly use the Locks and Latches plugin to set up locks between the check-out job and the build jobs so you don't end up with two jobs trying to copy/modify the files simultaneously. 可能使用Locks and Latches插件在结账作业和构建作业之间设置锁定,因此您不会最终尝试同时复制/修改文件的两个作业。

It sounds messy and potentially fraught with problems, but it might work. 这听起来很混乱,可能充满问题,但它可能会奏效。

Alternately, if you want to just chain all these projects together, you could set up a single job that does the checkout and has a build step for each project. 或者,如果您只想将所有这些项目链接在一起,则可以设置一个执行结帐的作业,并为每个项目创建一个构建步骤。 Then you could just check the Build Periodically trigger to have it run as often as you want (or at least as often as Hudson can get through the tasks). 然后你可以只检查Build周期性触发器,让它按照你想要的频率运行(或者至少和Hudson可以完成任务一样频繁)。

My take on the problem: 我对这个问题的看法:

Use the SVN post-commit hook to trigger a preliminary job which a) checks out the code; 使用SVN post-commit钩子来触发初步工作,a)检查代码; b) gets the SVN revision (eg via SVNVERSION.EXE); b)获取SVN修订版(例如通过SVNVERSION.EXE); and c) uses the Parameterized Trigger plugin to trigger the "real" build job at the specific SVN revision ID. c)使用参数化触发器插件触发特定SVN修订版ID的“真实”构建作业。

This way you separate the SCM connection from the actual building, so that you can be very specific about building every revision. 这样您就可以将SCM连接与实际构建分开,这样您就可以非常具体地构建每个修订版本。

you can always add a shell script as a build step. 您始终可以添加shell脚本作为构建步骤。

use a parameterized build, declare the revision as parameter, use the parameter in your shell script (skipping Hudson SCM management entirely) 使用参数化构建,将修订声明为参数,在shell脚本中使用该参数(完全跳过Hudson SCM管理)

http://wiki.hudson-ci.org/display/HUDSON/Parameterized+Build http://wiki.hudson-ci.org/display/HUDSON/Parameterized+Build

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM