Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-42930

Use System proxy when available

    XMLWordPrintable

Details

    • New Feature
    • Status: Resolved (View Workflow)
    • Major
    • Resolution: Fixed
    • swarm-plugin
    • None
    • 3.17

    Description

      If System proxy is defined (with -Dhttps.proxyHost or -Dhttp.proxyHost) use it to connect to Jenkins master.

      I can provide a PR if you think that this feature may be useful.

      Attachments

        Activity

          basil Basil Crow added a comment -

          Released in 3.17.

          basil Basil Crow added a comment - Released in 3.17.
          basil Basil Crow added a comment -

          Fixed in #105 and will be released in 3.17.

          basil Basil Crow added a comment - Fixed in #105 and will be released in 3.17.
          basil Basil Crow added a comment -

          I took a shot at implementing this in #105. That change uses the SystemDefaultHttpClient class, which supports the following Java properties:

          The following system properties are taken into account by this class:

          • ssl.TrustManagerFactory.algorithm
          • javax.net.ssl.trustStoreType
          • javax.net.ssl.trustStore
          • javax.net.ssl.trustStoreProvider
          • javax.net.ssl.trustStorePassword
          • java.home
          • ssl.KeyManagerFactory.algorithm
          • javax.net.ssl.keyStoreType
          • javax.net.ssl.keyStore
          • javax.net.ssl.keyStoreProvider
          • javax.net.ssl.keyStorePassword
          • http.proxyHost
          • http.proxyPort
          • https.proxyHost
          • https.proxyPort
          • http.nonProxyHosts
          • http.keepAlive
          • http.maxConnections

          The semantics of these properties are defined here.

          I don't have a proxy server against which to test this. Is anyone willing to try out my PR against their proxy server and report back with the results?

          basil Basil Crow added a comment - I took a shot at implementing this in #105 . That change uses the SystemDefaultHttpClient class, which supports the following Java properties: The following system properties are taken into account by this class: ssl.TrustManagerFactory.algorithm javax.net.ssl.trustStoreType javax.net.ssl.trustStore javax.net.ssl.trustStoreProvider javax.net.ssl.trustStorePassword java.home ssl.KeyManagerFactory.algorithm javax.net.ssl.keyStoreType javax.net.ssl.keyStore javax.net.ssl.keyStoreProvider javax.net.ssl.keyStorePassword http.proxyHost http.proxyPort https.proxyHost https.proxyPort http.nonProxyHosts http.keepAlive http.maxConnections The semantics of these properties are defined here . I don't have a proxy server against which to test this. Is anyone willing to try out my PR against their proxy server and report back with the results?
          oleg_nenashev Oleg Nenashev added a comment -

          KK does not maintain this plugin anymore. Moving to unassigned to set the expectation

          oleg_nenashev Oleg Nenashev added a comment - KK does not maintain this plugin anymore. Moving to unassigned to set the expectation
          caley Caley Goff added a comment - - edited

          Hi, has there been any movement on this?

          I'm currently trying the following: 

          below is the JAVA_OPTS string I'm passing in

          SLAVE_JAVA_OPTS="-Dhttp.proxyHost=http://someawesomeproxy.com" "-Dhttp.proxyPort=8080" "-Dhttps.proxyHost=http://someawesomeproxy.com" "-Dhttps.proxyPort=8080" "-Dhttp.nonProxyHosts=localhost|127.0.0.1|.someinternaldomain.com|.someinternaldomain2.com|jenkins-master"

          For posterity I'm also including environment variables that are in defaults for more linux environments:

          HTTP_PROXY=http://someawesomeproxy.com:8080
          HTTPS_PROXY=http://someawesomeproxy.com:8080
          NO_PROXY=.someinternaldomain.com,.someinternaldomain2.com,jenkins-master

          Here is where I actually try to launch the agent:

          (exec java ${SLAVE_JAVA_OPTS} -jar /bin/swarm-client.jar -labels jobs-builder -disableSslVerification -executors 5 -master ${JENKINS_MASTER} -username ${JENKINS_SLAVE_USER} -password  ${JENKINS_SLAVE_PASS} -name swarm -mode exclusive)

          Here is the error I get when trying to run the agent: 

          Error: Could not find or load main class "-Dhttp.proxyHost=http:..someawesomeproxy.com"
          

          I notice the description doesn't include https.proxyHost or http.nonProxyHosts. If this is to be properly implemented the aforementioned items must also be added.

          My use case is a little different the original reporter. I dont need to use a proxy to talk to the Jenkins Master. I need the slaves to use the proxy when executing builds in the jenkins master/slave scenario. Right now my builds fail that need to reach the public internet, and trying to add in a proxy for the JVM to use for all requests causes the swarm agent to fail because it doesn't recognize the variables I'm passing in.

          caley Caley Goff added a comment - - edited Hi, has there been any movement on this? I'm currently trying the following:  below is the JAVA_OPTS string I'm passing in SLAVE_JAVA_OPTS= "-Dhttp.proxyHost=http: //someawesomeproxy.com" "-Dhttp.proxyPort=8080" "-Dhttps.proxyHost=http://someawesomeproxy.com" "-Dhttps.proxyPort=8080" "-Dhttp.nonProxyHosts=localhost|127.0.0.1|.someinternaldomain.com|.someinternaldomain2.com|jenkins-master" For posterity I'm also including environment variables that are in defaults for more linux environments: HTTP_PROXY=http: //someawesomeproxy.com:8080 HTTPS_PROXY=http: //someawesomeproxy.com:8080 NO_PROXY=.someinternaldomain.com,.someinternaldomain2.com,jenkins-master Here is where I actually try to launch the agent: (exec java ${SLAVE_JAVA_OPTS} -jar /bin/swarm-client.jar -labels jobs-builder -disableSslVerification -executors 5 -master ${JENKINS_MASTER} -username ${JENKINS_SLAVE_USER} -password  ${JENKINS_SLAVE_PASS} -name swarm -mode exclusive) Here is the error I get when trying to run the agent:  Error: Could not find or load main class "-Dhttp.proxyHost=http:..someawesomeproxy.com" I notice the description doesn't include https.proxyHost or http.nonProxyHosts. If this is to be properly implemented the aforementioned items must also be added. My use case is a little different the original reporter. I dont need to use a proxy to talk to the Jenkins Master. I need the slaves to use the proxy when executing builds in the jenkins master/slave scenario. Right now my builds fail that need to reach the public internet, and trying to add in a proxy for the JVM to use for all requests causes the swarm agent to fail because it doesn't recognize the variables I'm passing in.

          People

            basil Basil Crow
            mnantern Matthieu Nantern
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: