This is the minimal svn post-commit hook that worked for me:
#!/bin/sh
REPO="$1"
REV="$2"
UUID="$(/usr/bin/svnlook uuid ${REPO})"
CHANGED="$(/usr/bin/svnlook changed -r ${REV} ${REPO})"
SERVER_URL="https://<redacted>/jenkins"
USER="<redacted>"
API_TOKEN="<redacted>" # not the password
/usr/bin/curl -X POST -s -u "${USER}:${API_TOKEN}" -d "${CHANGED}" ${SERVER_URL}/subversion/${UUID}/notifyCommit
Notes:
- CSRF is enabled, but
USER:API_TOKEN
seems to be enough (no need for crumbs).
- Not specifying any
Content-Type
headers seems to be just fine
- Not sending
?rev=${REV}
seems to be just fine (what's the difference?)
- Not necessary to configure special build trigger tokens (see screenshot)
Jenkins log output with (8,706) and without (-1) rev parameter:
May 15, 2019 8:04:28 PM INFO jenkins.scm.impl.subversion.SubversionSCMSource$ListenerImpl onNotify
Received post-commit hook from f9.... for revision [8,706 vs -1] on paths [project1/pom.xml, ...]
May 15, 2019 8:04:28 PM INFO jenkins.scm.impl.subversion.SubversionSCMSource$ListenerImpl onNotify
No subversion consumers for UUID f9....
May 15, 2019 8:04:28 PM INFO hudson.triggers.SCMTrigger$Runner run
SCM changes detected in project1. Triggering #20
Job configuration:
