8

The environment variables %SVN_REVISION% and %SVN_URL% aren't set when I use a SVN repository running on a Visual SVN server. All other SVN interactions work fine, e.g. checkout and change detection. Running the job with another SVN server works too.

Freestyle job configuration:

Repository URL:            http://SERVERNAME:81/svn/Projects/ProjectName__5_9_1_3/trunk
Local module directory:    trunk
Repository depth option:   infinity

Output of windows set command in the build operation (SVN_REVISION and SVN_URL missing)

...
SESSIONNAME=RDP-Tcp#0
SystemDrive=C:
SystemRoot=C:\Windows
...

System information

  • Jenkins: v1.531
  • Subversion plugin: v1.51
  • JAVA Runtime: v1.6.0_35
  • VisualSVN Server: v2.7
Sascha Vetter
  • 2,243
  • 1
  • 17
  • 35

2 Answers2

7

The Jenkins error log put me on the right track:

WARNUNG: no revision found corresponding to http://SERVERNAME/svn/Project/trunk; known: [http://servername/svn/Project/trunk]

It seems that Jenkins/subversion/SVNKit is case sensitive and in my case I wrote the server name in capital letters by mistake.

Sascha Vetter
  • 2,243
  • 1
  • 17
  • 35
  • 2
    As discussed with KostyaSha on #jenkins, https://github.com/jenkinsci/subversion-plugin/blob/5c4c1de863a6c6201c5834f72da016b574682c65/src/main/java/hudson/scm/SubversionSCM.java#L710 should perhaps be amended to compare `java.net.URI`s rather than `String`s. – Jesse Glick Jun 30 '14 at 16:29
  • 2
    Got bit by this one today, the server name must be all lower case for svn env vars to be set correctly. – StormRider01 Feb 04 '15 at 20:31
  • 2
    It also doesn't like the %20 value that Windows likes to replace spaces characters with. Took me a while to track it down because it ran the checkout and build without any problems. – OttPrime Jun 23 '16 at 19:48
  • @StormRider01 Changing the server name part of the SVN url to lower case worked for me !!! – Rajaraman Nov 12 '19 at 10:34
1

It happened to me today that I have several SVN paths being checked out for the project and thus they all have different revision number. Jenkis ended up creating several variables: SVN_REVSION_1, SVN_REVISION_2, etc...

You can add at the end a Batch script and use the SET command (Windows) so you can see in the console output all the variables available and their values.

Guillermo Ruffino
  • 2,651
  • 1
  • 22
  • 21
  • When you have multiple paths being checked out, Jenkins' behaviour is to create `SVN_REVISION_1` etc. for each path so you can optionally use those, but crucially it still SHOULD define `SVN_REVISION` & `SVN_URL` set to the the first svn path in your job configuration. The OP's problem & solution are unrelated to there being multiple paths. – Erik Feb 22 '18 at 11:52
  • Well it does not define a SVN_REVISION for the first... so I googled it and ended up here. After more research I found this behavior. And this answer fits perfectly with the OP title. I’m sorry this answer did not help you. It did help someone else before. – Guillermo Ruffino Feb 23 '18 at 12:45