currently I am working with Jenkins CI Server and I want to trigger a job/build via svn post commit hook. So far it works as expected, but the build uses the previous svn revision.
For example: I check in my files and the client shows me revision 90, the build starts, but it uses 89.
The post-commit hook looks like that:
UUID=`svnlook uuid $REPOS`
/usr/bin/wget \
--header "Content-Type:text/plain;charset=UTF-8" \
--post-data "`svnlook changed --revision $REV $REPOS`" \
--output-document "-" \
--timeout=2 \
http://ci-jenkins/job/Job1/build?rev=$REV 1>&2
The Check-out Strategy in Jenkins in configured "Always check out a fresh copy". What is wrong? I am still starting with that and have much to learn. So please keep that in mind for answering me. :-)
As it does for other SCM solutions, Jenkins has a dedicated plugin to support Subversion, one of the most widely used SCMs. It is part of the core release and provided by default with your Jenkins installation files.
Essentially, what you can do is setup a svn commit hook that sends a signal to Jenkins to kick off a build. Jenkins will then (given the right build setup) pull the freshly-committed code and run the build. Jenkins is very capable, but it's not intended to be the Ultimate Build System all by itself.
Ran into the same issue and found this:
Basically you need to append @HEAD at the end of the SVN url, e.g.:
http://svn.yourserver.com/svn/project/trunk@HEAD
Make sure that the date/time on the Jenkins server matches the date/time on the SVN server (or is at least behind it).
Pretty sure Jenkins uses the date/time when doing it's checkouts and updates.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With