title: How do I trigger Jenkins build with SVN post-commit?
body: <p>I am trying to compose an SVN post-commit script, with the purpose of realizing that, whenever one of the developers commit to an SVN repository, it will trigger a Jenkins build and deploy the project automatically.</p>
  
  <p>I followed the instructions in <em><a href="https://wiki.jenkins-ci.org/display/JENKINS/Subversion+Plugin" rel="nofollow noreferrer">Subversion Plugin</a></em>, and my post-commit is like:</p>
  
  <pre><code>#!/bin/sh
  #
  # Jenkins SVN Build trigger script by Wessel de Roode Aug' 2011
  #
  
  # Please adjust
  SERVER=localhost                                                
  PORT=8080        
  WGET=/usr/bin/wget
  SVNLOOK=/usr/bin/svnlook
  
  # Don't change below this point
  ###############################
  
  REPOS="$1"
  REV="$2"
  UUID=`$SVNLOOK uuid $REPOS`
  
  echo "--------------------------------"&gt;&gt;${REPOS}/post-commit.log
  #
  # Check if "[X] Prevent Cross Site Request Forgery exploits" is activated
  # so we can present a valid crum or a proper header
  BREAD_URL='http://'${SERVER}:${PORT}'/crumbIssuer/api/xml?xpath=concat(//crumbRequestField,":",//crumb)'
  
  CRUMP=`$WGET --append-output=${REPOS}/post-commit.log --output-document -${BREAD_URL}`
  if [ "$CRUMP" == "" ]
  then
      HEADER="Content-Type:text/plain;charset=UTF-8"
  else
      HEADER=$CRUMP
  fi
  
  $WGET \
      --http-user=JENKINS_USER --http-password=JENKINS_PW \
      --header ${HEADER} \
      --post-data "`$SVNLOOK changed --revision $REV $REPOS`" \
      --append-output=${REPOS}/post-commit.log  \
      --output-document "-"\
      --timeout=2 \
      http://${SERVER}:${PORT}/jenkins/subversion/${UUID}/notifyCommit?rev=$REV\
  
  # Uncomment line below for debug
  echo $(date) HEADER=${HEADER} REPOS=$REPOS REV=$REV UUID=${UUID} http://${SERVER}:${PORT}/subversion/${UUID}/notifyCommit?rev=$REV &gt;&gt;${REPOS}/post-commit.log
  </code></pre>
  
  <p>When I commit something from an SVN client, the log is as follows:</p>
  
  <pre><code>--2015-04-03 21:01:20--  http://localhost:8080/crumbIssuer/api/xml?xpath=concat(//crumbRequestField,%22:%22,//crumb)
  Resolving localhost (localhost)... ::1, 127.0.0.1
  Connecting to localhost (localhost)|::1|:8080... connected.
  HTTP request sent, awaiting response... 404 Not Found
  2015-04-03 21:01:20 ERROR 404: Not Found.
  
  Fri Apr 3 21:01:20 KST 2015 HEADER=Content-Type:text/plain;charset=UTF-8 REPOS=/home/share/svn/myblog REV=30 UUID=d6922f4b-358e-4015-8fd3-a25217326040 http://localhost:8080/subversion/d6922f4b-358e-4015-8fd3-a25217326040/notifyCommit?rev=30
  --2015-04-03 21:01:20--  http://localhost:8080/jenkins/subversion/d6922f4b-358e-4015-8fd3-a25217326040/notifyCommit?rev=30
  Resolving localhost (localhost)... ::1, 127.0.0.1
  Connecting to localhost (localhost)|::1|:8080... connected.
  HTTP request sent, awaiting response... 403 Forbidden
  2015-04-03 21:01:20 ERROR 403: Forbidden.
  </code></pre>
  
  <p>For the <em>"404 Not Found error"</em>, I checked the <em>Global Security</em> configuration in Jenkins:</p>
  
  <p><img src="https://i.stack.imgur.com/YxAxL.png" alt="Jenkins security setting"></p>
  
  <p>I have no idea why the error occurs at all.</p>
  
  <p>And for the <em>"403 Forbidden error"</em>, referring to the previous screen capture, I have provided a user/password, JENKINS_USER/JENKINS_PW (even though they say I shall use the API token instead of the plain text of the password), why is it forbidden?</p>