EnvVar SVN_REVISION and SVN_URL not set
Asked Answered
S

2

7

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
Sled answered 27/9, 2013 at 13:13 Comment(0)
S
8

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.

Sled answered 30/9, 2013 at 15:17 Comment(6)
As discussed with KostyaSha on #jenkins, github.com/jenkinsci/subversion-plugin/blob/… should perhaps be amended to compare java.net.URIs rather than Strings.Kliment
Got bit by this one today, the server name must be all lower case for svn env vars to be set correctly.Eakins
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.Dogwood
@Eakins Changing the server name part of the SVN url to lower case worked for me !!!Snobbish
in my case there was an extra / in the urlGeorgettageorgette
@Georgettageorgette Happy to hear that this still helps people 9 yrs after posting!Sled
P
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.

Pattison answered 30/6, 2015 at 2:41 Comment(2)
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.Hardej
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.Pattison

© 2022 - 2024 — McMap. All rights reserved.