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

Different Proxy Configuration Between Controller and Agent

XMLWordPrintable

      We are using a Jenkins controller which requires a proxy to reach github.com with agents that do not require a proxy for access. The proxy we need to use for the controller is not reachable from the agents.

      It does not appear it is possible to get this configuration working. We can configure a proxy in the Plugins settings page, but this gets applied to both the controller and git checkouts on the agents. 

      We tried configuring the HTTP_PROXY and HTTPS_PROXY environment variables on the controller, but it appears these are not respected by github-branch-source-plugin (okhttp3).

      With a proxy configured on the controller, we get the following error when attempting a build on an agent:
      stderr: fatal: unable to access 'https://github.com/ORG/REPO.git/': Recv failure: Connection was reset
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2842)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2185)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:635)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:871)
      at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$GitCommandMasterToSlaveCallable.call(RemoteGitImpl.java:170)
      at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$GitCommandMasterToSlaveCallable.call(RemoteGitImpl.java:161)
       
      Without a proxy configured on the controller, the build fails to start:

      java.net.UnknownHostException: api.github.com
      at java.base/java.net.InetAddress$CachedAddresses.get(InetAddress.java:797)
      at java.base/java.net.InetAddress.getAllByName0(InetAddress.java:1524)
      at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1382)
      at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1306)
      at okhttp3.Dns$Companion$DnsSystem.lookup(Dns.kt:49)
      at okhttp3.internal.connection.RouteSelector.resetNextInetSocketAddress(RouteSelector.kt:169)
      at okhttp3.internal.connection.RouteSelector.nextProxy(RouteSelector.kt:131)
      at okhttp3.internal.connection.RouteSelector.next(RouteSelector.kt:73)
      at okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.kt:205)
      at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.kt:106)
      at okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.kt:74)
      at okhttp3.internal.connection.RealCall.initExchange$okhttp(RealCall.kt:255)
      at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:32)
      at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
      at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95)
      at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
      at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83)
      at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
      at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76)
      at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
      at org.kohsuke.github.extras.okhttp3.ObsoleteUrlFactory$UnexpectedException.lambda$static$0(ObsoleteUrlFactory.java:1364)
      at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
      at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
      at okhttp3.internal.connection.RealCall.execute(RealCall.kt:154)
      at org.kohsuke.github.extras.okhttp3.ObsoleteUrlFactory$OkHttpURLConnection.getResponse(ObsoleteUrlFactory.java:670)
      at org.kohsuke.github.extras.okhttp3.ObsoleteUrlFactory$OkHttpURLConnection.getResponseCode(ObsoleteUrlFactory.java:701)
      at org.kohsuke.github.extras.okhttp3.ObsoleteUrlFactory$DelegatingHttpsURLConnection.getResponseCode(ObsoleteUrlFactory.java:1063)
      at org.kohsuke.github.internal.GitHubConnectorHttpConnectorAdapter.send(GitHubConnectorHttpConnectorAdapter.java:87)
      at org.kohsuke.github.GitHubClient.sendRequest(GitHubClient.java:461)

            markewaite Mark Waite
            mgrochowalski Matt Grochowalski
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: