Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Hudson be configured to build every revision?

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?

like image 719
CodeBuddy Avatar asked Jun 04 '09 07:06

CodeBuddy


3 Answers

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

  • add a REVISION string parameter to your job
  • append the ${REVISION} parameter to the repository URL,
    e.g.: https://server/path/myproject${REVISION}
  • set the name of the local folder to 'myproject' (see previous example), because the 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}
  • trigger the parameterized build from the post-commit hook, like that: /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:

  • if you want to build HEAD revision, you must leave the REVISION parameter empty
  • if you want to build a specific revision, you have to enter @NNN (eg: @1234).

The @ sign is very important because all this trick relies on the fact that Subversion plugin interprets URL@NNN as get revision NNN from repository at URL. If you forget the @, Subversion will just say it can't find folder https://server/path/myprojectNNN. That's also why you have to put %40 between REVISION= and $REV in the wget command, %40 is the escaped character for @.

like image 179
fchateau Avatar answered Sep 27 '22 17:09

fchateau


Hudson does not yet have this capability, but its been asked for a few times on the mailing list. See issue 673

like image 34
Michael Donohue Avatar answered Sep 27 '22 16:09

Michael Donohue


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

like image 39
grapkulec Avatar answered Sep 27 '22 18:09

grapkulec