Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How do you configure Jenkins to work with a proxy server?

We are facing some issues using a proxy server (i.e. caching server) with Jenkins and was hoping someone could provide insight if they have a similar setup in place.   Here’s a brief description of our setup:

At primary site A we have a reverse proxy, JTS & CCM server.  At remote site B, we have a proxy server, using Squid for caching, to improve loading times of our source code.  Site B also has a Jenkins server configured to manage our builds.

To leverage the proxy server all a user has to do on his or her host is:

1.       Open Internet Explorer

2.       Go to Internet Options  and select the Connections tab

3.       Select LAN settings

4.       Enter the Proxy server host name and port in the configuration below

This works great outside of Jenkins (i.e. using Visual Studio).   If we implement the same solution on the Jenkins server, and run a job it completely ignores the proxy settings in IE.  I turned to two other solutions I saw in various postings but the proxy server is still being ignored by Jenkins.  The other two solutions are as follows:

Solution #1

1.       Log on to your Jenkins GUI

2.       Select Manage Jenkins

3.       Select Manage Plugins

  

4.       Select the Advanced tab

5.       Enter the proxy server host name and port number

6.       Click on the Advanced… button and validate the test URL . If all works then submit to save.

7.       Restart Jenkins, verity that the proxy settings are still set, and perform a workspace load with a Jenkins job to test

Solution #2

1.       Log on to your Jenkins master host.

2.       Go to the installation directory for Jenkins (i.e. C:\Program Files (x86)\Jenkins)

3.       Make a copy of the jenkins.xml file as a backup

4.       Edit jenkins.xml and add the following two arguments for starting jenkins:

-Dhttp.proxyHost=http://ProxyServerName -Dhttp.proxyPort=3128

In the file the XML looks as follows:

<service>

  <id>jenkins</id>

  <name>Jenkins</name>

  <description>This service runs Jenkins continuous integration system.</description>

  <env name="JENKINS_HOME" value="%JENKINS_HOME%"/>

  <!--

    if you'd like to run Jenkins with a specific version of Java, specify a full path to java.exe.

    The following value assumes that you have java in your PATH.

  -->

  <executable>%BASE%\jre\bin\java</executable>

  <arguments> -Dhttp.proxyHost=http://ProxyServerName -Dhttp.proxyPort=3128 -Xrs -Xmx256m -Djava.library.path="C:\natives;%Path% " -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\jenkins.war"</arguments>

  <logmode>rotate</logmode>

  <onfailure action="restart" />

</service>

5.       Save the file, restart Jenkins, and perform a workspace load with a Jenkins job to test

Both solutions fail to leverage our proxy server to cache source code.   Any idea what we could be doing wrong?  Is this even the right place to set the proxy setting for Jenkins to leverage a caching server?

Thanks 

0 votes


Accepted answer

Permanent link
 For those wanting to know the fix was to modify the file jenkins.xml where the argument -Dhttp.proxyHost should have had a value of "ProxyServerName" and NOT "http://ProxyServerName". 
Ralph Schoon selected this answer as the correct answer

0 votes

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 6,121
× 1,700
× 151
× 26
× 2

Question asked: Jan 11 '16, 5:31 p.m.

Question was seen: 193,804 times

Last updated: Mar 23 '18, 2:22 a.m.

Confirmation Cancel Confirm