Jenkins CI uses wrong svn revision for build
Ran into the same issue and found this:
Basically you need to append @HEAD at the end of the SVN url, e.g.:
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.
Hi, currently I am working with Jenkins CI Server and I want to trigger a job/build via svn post commit hook.
Okay, I'll bite: Why are you not simply allowing Jenkins to be triggered by a Subversion commit?
I've seen people do this for CVS because Jenkins can take a long time to poll CVS to see if a CVS commit has been made. But, Jenkins takes just a few seconds to determine that a Subversion commit has been done.
If you really insist on triggering a Jenkins build yourself, why not simply configure your projects to allow remote triggering? Under the Build Triggers section for each job, you specify a token and then trigger that with wget:
wget $JENKINS_URL/job/foo?token=BUILD_NOW
(Assuming the token you've set is BUILD_NOW
)
This way, you don't have to worry about the revision and Jenkins will build the last revision that was checked in.
Others feel this is a time synchronization issue, but I'm not so sure. You are passing the build number in your argument. You can try a few things:
- Sleep for 30 or so seconds before triggering the build and see if that helps. I wouldn't keep it in the script because it delays the Subversion commit, but it might help you determine that this isn't a timing issue.
- What if you add one to
$REV
and then trigger the Jenkin's build? Maybe that'll take care of the problem.