Search code examples
svnjenkinsredhatpost-commit-hookubersvn

uberSVN branch post-commit hook


We are using uberSVN installed on linux. In the repository "R" we have different branches and I need to trigger the jenkins job for a commit on a specific branch "B". In the ....repository/R/hooks/ there is file named post-commit. The file content is below:

REPOS="$1"
REV="$2"

wget "http://jenkinsurl/job/project_r/build?tokten=r_token"

The above script calls wget whenever repo has been commited. On the other hand, I want to trigger "the branch job" if and only if there is a commit on branch "B" not all repository. The jenkis url is below:

wget "http://jenkinsurl/job/project_r_b/build?tokten=r_b_token"

What is the proper way to do this?


Solution

  • You can call svnlook dirs-changed to get changed paths in the committed revision. Pipe this command's output to grep and search for "branches/b". If the output of the command has "/branches/b", then run the job. Exit, otherwise.

    Check this question for the sample code: Post-commit hook failed (exit code 3) with output.