Can Hudson be configured to build each revision?

I started experimenting with Hudson as a build server. I use subversion and am set to poll every minute. The problem that I see is that if the build in edition 10 takes 5 minutes, and during this time there are 5 commits, Hudson will continue to build version 15.

Is there a way to ensure that each revision is built?

+7
svn continuous-integration hudson build-server
source share
5 answers

Hudson does not yet have this feature, but he has been asked several times on the mailing list. See issue 673

+4
source share

You have to do a few things to accurately build each revision:

  • add the REVISION string parameter to your task
  • add the parameter ${REVISION} to the URL of the repository,
    for example: https://server/path/myproject${REVISION}
  • set the name of the local folder to "myproject" (see the previous example), since the REVISION variable is expanded only in the URL, but when creating the folder, Hudson will not expand it, resulting in a folder with the name: myproject${REVISION}
  • starts the parameterized assembly from the post-commit binding, for example: /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 start the assembly manually, you have two options:

  • If you want to build a HEAD revision, you must leave the REVISION parameter empty.
  • If you want to create a specific revision, you need to enter @NNN (for example: @ 1234).

The @ sign is very important, because all this trick depends on the fact that the Subversion plugin interprets the URL@NNN as get revision NNN from repository at URL . If you forget @ , Subversion will simply say that it cannot find the https://server/path/myprojectNNN folder. This is why you must put %40 between REVISION= and $REV in the wget command, %40 is the escaped character for @ .

+10
source share

Regarding the SCM assembly configuration, you should have the "Assembly triggers" section and the option "The trigger builds remotely (for example, from scripts)". According to the reference information next to this option, you can script execute a post-commit so that each commit starts a new assembly. Since hudson has a build queue, you must have every revision.

Here's a link that may help you: https://hudson.dev.java.net/build.html

Here's an example of how to start building a job with parameters (see my comment for details): http://wiki.hudson-ci.org/display/HUDSON/Parameterized+Build

+1
source share

The key to making sure every commit is built in Hudson is a โ€œParameterized buildโ€ and ONLY IF a trigger build with different parameter values, hudson will consider it a new build and should be held in the build queue. Or he will not be recorded by Hudson, as he considers it a meaningless assembly compared to the previous one.

eg. you can click "Build Now" for the build trigger three times and just leave the build para as "null". You will see that only the first two assemblies are in Hudson's lineup. The third will be ignored: P is cool, but itโ€™s very bad that it was not found in some document, but with my experiments at a time :(

0
source share

I took the fchateaus approach above (thanks man!) And modified it to work with Mercurial.

You will need to edit the .hg / hgrc file on the central server and put the changegroup switch in it. Keep in mind that change groups only set the first set of changes to the HG_NODE environment variable, so you need to do an hg tip to grab the real node advice and pass it via the URL instead. A little trick in a single line liner, but I figured it out.

This is what you would do for Windows-based Hudson.

 [hooks] # this uses wget to hit the hudson url responsible for starting a build - %HG_NODE% only gets first changeset of changegroup, so use hg tip to grab changeset most recently added instead changegroup.hudson = for /f "tokens=*" %G IN ('hg tip --template {node}') DO "C:\Program Files (x86)\UnxUtils\usr\local\wbin\wget" --non-verbose --spider http://HudsonServer:8080/job/{Repository}/buildWithParameters?HgRevId=%G | ECHO Result of Hudson Polling Request For Node %G # TODO: when Hudson implements polling with parameters, change to something like this #changegroup.hudson = for /f "tokens=*" %G IN ('hg tip --template {node}') DO "C:\Program Files (x86)\UnxUtils\usr\local\wbin\wget" --non-verbose --spider http://HudsonServer:8080/job/{Repository}/polling?HgRevId=%G | ECHO Result of Hudson Polling Request For Node %G 
0
source share

All Articles