2

We have a Subversion repository located on an https connection. I am able to connect to it locally (no proxy needed):

$ svn ls --username=qazwart --password=swordfish \
    https://svn.corpwad.com/repos/potzrebie/branches/build-test
build.xml
src
...

Now, I log onto our build server which requires a proxy:

$ ssh tomcat@jenkins.corpwad.net
Last login: Thu Aug 14 09:22:48 2014 from qazwart.corpwad.net
$ export | egrep "JENKINS|_proxy"
declare -x JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true -Dhttps.proxyHost=proxy.corpwad.net -Dhttp.proxyHost=proxy.corpwad.net -Dhttp.proxyPort=3128 -Dhttps.proxyPort=3128 -Dhttp.auth.preference=Basic"
declare -x http_proxy="http://proxy.corpwad.net:3128"
declare -x https_proxy="http://proxy.corpwad.net:3128"

As you can see, I have JENKINS_JAVA_OPTOPNS set for my proxy, and I have https_proxy set. Proxy doesn't require a login although our Subversion repo does:

Let's try wget:

$ wget -O - --user=qazwart --password=swordfish https://svn.corpwad.com/repos/potzrebie/branches/build-test
--2014-08-14 09:54:09--  https://svn.corpwad.com/repos/potzrebie/branches/build-test
Resolving proxy.ilcb.tcprod.local... 10.80.12.90
Connecting to proxy.corpwad.net|10.80.12.90|:3128... connected.
Proxy request sent, awaiting response... 401 Authorization Required
Connecting to proxy.corpwad.net|10.80.12.90|:3128... connected.
Proxy request sent, awaiting response... 301 Moved Permanently
Location: https://svn.corpwad.com/repos/potzrebie/branches/build-test [following]
--2014-08-14 09:54:10--  https://svn.corpwad.com/repos/potzrebie/branches/build-test
Connecting to proxy.ilcb.tcprod.local|10.80.12.90|:3128... connected.
Proxy request sent, awaiting response... 200 OK
Length: 1130 (1.1K) [text/html]
Saving to: “STDOUT”

 0% [                                                                               ] 0            --.-K/s              <html><head><title> potzrebie - Revision 1937: /branches/build-test</title></head>
<body>
 <h2> potzrebie - Revision 1937: /branches/build-test</h2>
 <ul>
  <li><a href="../">..</a></li>
  <li><a href="build.xml">build.xml</a></li>
  ...
 </ul>
100%[==============================================================================>] 1,130       --.-K/s   in 0s      

2014-08-14 09:54:10 (51.6 MB/s) - written to stdout [1130/1130]
$

Okay, I can through wget to connect to my repository. That means I do have network connectivity to our repository from our build server. Unfortunately, my system doesn't have a Subversion command line client for testing. I'll have to ask our IT department to install the RPM for it, but right now, I can't test that. Fortunately, Jenkins does not require the command line client since it uses svnkit. : I create a Jenkins Freestyle job, select Subversion as my repository, and in the Repository URL field, I'll put https://svn.corpwad.com/repos/potzrebie/branches/build-test. I setup a gloabal credential with the user qazwart and password swordfish. However, while still on our build configuration screen, I get this:

Unable to access https://svn.corpwar.com/repos/potzrebie/branches/build-test : svn: E175002: OPTIONS /repos/potzrebie/branches/build-test failed 
org.tmatesoft.svn.core.SVNException: svn: E175002: OPTIONS /repos/potzrebie/branches/build-test failed
    at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection.request(HTTPConnection.java:388)
    at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection.request(HTTPConnection.java:373)
    at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection.request(HTTPConnection.java:361)
    at org.tmatesoft.svn.core.internal.io.dav.DAVConnection.performHttpRequest(DAVConnection.java:707)
....
Caused by: svn: E175002: OPTIONS /repos/potzrebie/branches/build-test failed
        at org.tmatesoft.svn.core.SVNErrorMessage.create(SVNErrorMessage.java:208)
        at org.tmatesoft.svn.core.SVNErrorMessage.create(SVNErrorMessage.java:154)
        at org.tmatesoft.svn.core.SVNErrorMessage.create(SVNErrorMessage.java:97)
        ... 88 more
Caused by: org.tmatesoft.svn.core.SVNException: svn: E175002: OPTIONS request failed on '/repos/potzrebie/branches/build-test'
svn: E175002: connection refused by the server
        at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:64)
        at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:51)
        at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection._request(HTTPConnection.java:777)
        at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection.request(HTTPConnection.java:382)
        ... 87 more
Caused by: svn: E175002: OPTIONS request failed on '/repos/potzrebie/branches/build-test'
        at org.tmatesoft.svn.core.SVNErrorMessage.create(SVNErrorMessage.java:208)
        at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection._request(HTTPConnection.java:775)
        ... 88 more
Caused by: svn: E175002: connection refused by the server
        at org.tmatesoft.svn.core.SVNErrorMessage.create(SVNErrorMessage.java:208)
        at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection._request(HTTPConnection.java:520)
        ... 88 more
Caused by: java.net.ConnectException: Connection refused
        at java.net.PlainSocketImpl.socketConnect(Native Method)

I have a feeling that I'm missing one more minor step, but I can't figure it out.

David W.
  • 391
  • 3
  • 5
  • 15

2 Answers2

2

Found the issue. Although I am setting JENKINS_JAVA_OPTIONS, it wasn't getting set when Tomcat itself was starting. I went into $CATALINA_BASE/bin/setenv.sh and added:

CATALINA_OPTS="$CATALINA_OPTS $JENKINS_JAVA_OPTIONS -DJENKINS_HOME=...

This sets the requires properties when Java starts.

David W.
  • 391
  • 3
  • 5
  • 15
0

I found an alternate means of getting these values into Java that worked for me under a Windows Context.

Under C:\Program Files (x86)\Jenkins\jenkins.xml

I edited the line that fed into java from

<arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\jenkins.war" --httpPort=8080 --webroot="%BASE%\war"</arguments>

to

<arguments>-Xrs -Xmx256m -Djava.awt.headless=true -Dhttp.proxyHost=proxy.myproxy.com Dhttp.proxyPort=99999 -Dhttp.auth.preference=Basic -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\jenkins.war" --httpPort=8080 --webroot="%BASE%\war"</arguments>

The key insertion being -Dhttp.proxyHost=proxy.myproxy.com Dhttp.proxyPort=99999 -Dhttp.auth.preference=Basic

Jenkins.xml File

The Jenkins.xml file itself led me to go search out where this jre\bin\java executable file might be so I might probe it to gain a better understanding of the role of its commandline arguments. As I found out under C:\Program Files (x86)\Java\jre6\bin>java the arguments having the form -D<name>=<value> was the family of arguments I needed to set to get the proxy settings properly communicated to Java. java commandline arguments

I was greatly struggling trying to get my SVN setup to work behind the proxy server, and it was very confusing as Jenkins itself could connect to the proxy as told by the proxy settings I had enabled for it which passed the test. Its very unintuitive that further settings would be needed beyond this to establish proxy settings. JenkinsProxyConnectionSuccess

Just to help any others stumbling onto this problem the errors I originally encountered came as:

Checking out a fresh workspace because there's no workspace at C:\SVNXXX\JenkinsWorkspace
Cleaning local Directory .
Checking out http://xxxxxxxxxx/trunk at revision '2016-03-18T16:12:17.711 -0700'
ERROR: Failed to check out http://xxxxxxxxxxxx/trunk
org.tmatesoft.svn.core.SVNException: svn: E175002: connection refused by the server
svn: E175002: OPTIONS request failed on 'xxxxxxxxx/trunk'
jxramos
  • 789
  • 1
  • 8
  • 11