0

I have written a post-commit hook just like as its shown in https://wiki.jenkins-ci.org/display/JENKINS/Subversion+Plugin to trigger a Jenkins build if someone commits something to subversion.

Recently, one of our authentication servers for Jenkins went down. My post-commit hook does not timeout in 2 secs. It waits and waits. How do I set a timeout for this in my post-commit hook?

bahrep
  • 29,961
  • 12
  • 103
  • 150
user1164061
  • 4,222
  • 13
  • 48
  • 74

1 Answers1

1

I'm not 100% sure what step failed for you. I'm assuming the POST to Jenkins failed (and not the svnlook to get the changes) and I'm assuming you're using wget as in the Jenkins example.

Instead of:

/usr/bin/wget \
    --header "Content-Type:text/plain;charset=UTF-8" \
    --post-data "`svnlook changed --revision $REV $REPOS`" \
    --output-document "-" \
    $JENKINS/subversion/${UUID}/notifyCommit?rev=$REV

you can set the timeout with -T:

/usr/bin/wget -T 2 \
    --header "Content-Type:text/plain;charset=UTF-8" \
    --post-data "`svnlook changed --revision $REV $REPOS`" \
    --output-document "-" \
    $JENKINS/subversion/${UUID}/notifyCommit?rev=$REV

Try wget --help if you need more options.

Dave Bacher
  • 15,652
  • 3
  • 63
  • 86