Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins CI uses wrong svn revision for build

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. :-)

like image 943
Daniel Avatar asked May 03 '11 14:05

Daniel


People also ask

Is SVN supported on Jenkins?

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.

Can Jenkins pull code from SVN?

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.


2 Answers

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

like image 141
András Kerekes Avatar answered Sep 30 '22 15:09

András Kerekes


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.

like image 24
Chewpers Avatar answered Sep 30 '22 15:09

Chewpers