Hudson project with multiple triggers
I am building a continuous integration system with Hudson, and have a project split into two parts. The first is the main build and unit test element, which I want to run in the traditional CI fashion, triggered off SVN. The second is the functional tests, which take a long time to run, and so I want them to run overnight.
Is there any way of setting up a Hudson project with multiple triggers, i.e. so the functional tests run each night if and only if the main project has changed and has built successfully.
I've seen this question: Hudson - different build targets for different trigg开发者_JAVA技巧ers, but that simply runs each night regardless of the state of the main project.
I have exactly the same situation that you do: a build with some quick sanity tests tied to SVN, but a nightly regression test that takes longer.
Our solution was to use the DOS Build Trigger Plugin. On that build trigger, we attach a schedule that triggers once a night. The Trigger Script is a series of simple commands like this:
set CAUSE=
curl http://localhost:8080/job/THEBUILDJOB/lastSuccessfulBuild/artifact/fingerprint.txt -o current.txt
if not exist current.txt exit 0
fc /B current.txt last.txt
if ERRORLEVEL 1 set CAUSE=New build available
copy /y current.txt last.txt
This gets a particular file (fingerprint.txt) from the last successful build and compares it (via fc) to a copy we've stored in the workspace. If they match - no build occurs. If they're different, we trigger a build via the DOS Build Trigger by setting the CAUSE variable, then store the new file in the trigger's workspace.
精彩评论