views:

3717

answers:

3

Is there a way to configure Hudson to only execute Build or Post Build actions if there are changes in SVN/CVS

Thank you

+5  A: 

You can have Hudson poll the SCM for changes and only do things if it finds changes.

Poll SCM: Configure Hudson to poll changes in SCM.

Note that this is going to be an expensive operation for CVS, as every polling requires Hudson to scan the entire workspace and verify it with the server. Consider setting up a "push" trigger to avoid this overhead, as described in this document

You can also add something to your SCM post-commit hooks that will fire off a Hudson build.

Trigger builds remotely (e.g., from scripts): Enable this option if you would like to trigger new builds by accessing a special predefined URL (convenient for scripts).

One typical example for this feature would be to trigger new build from the source control system's hook script, when somebody has just committed a change into the repository, or from a script that parses your source control email notifications.

You'll need to provide an authorization token in the form of a string so that only those who know it would be able to remotely trigger this project's builds.

Instantsoup
Using Poll SCM as you mentionned is quite expensive operation for SVN. I was more thinking about triggering the build manually and then only if there are changes to SVN that the Build process get executed. Sometimes there are minor changes to SVN that doesn't necessitate a new Build
ken
Polling a subversion repository is incredibly cheap - the server returns the latest changelist number, which can be compared against the last version Hudson built. What makes you think it is expensive?
Michael Donohue
A: 

Hi, I have written a shell script to build my project using hudson. I have put some comments that will be displayed on the console by using echo command. This will help me to debug the scripts if there are any errors. Rigt now the script works fine without any bugs. But in future if there are any errors, I would like to See the logs and identify which part/command of the script is causing the problem.

In this regard I have two questions: 1. Where can I find the logs or the output of the build scripts? 2. Where can I see the hudson log files? I have started hudson by placing the hudson.war file under webapps folder of Tomcat.

Basavaraj Kanavalli
1- The output of your script is visible in the Console Output page. The link to the page is available in your build description page.The link to the console should look like http://yourserver/hudson/job/yourjobname/buildnumber/console2- Hudson logs should be available under the logs folder in your tomcat directory.
ken
A: 

It is not as simple as looking at the revision number (as stated elsewhere) unless your build is for the entire subversion repository. Typically you have projects sharing a single subversion repository and you are building some sub-tree. The global revision number doesn't help.

'svn info [url_to_subtree]' will show the Last Changed Date. You can parse this and figure out if it is later than your last build date and trigger a new build.

Darrell Denlinger