jenkinsci / jenkinsci/github-branch-source-plugin

[JENKINS-76244] Different Proxy Configuration Between Controller and Agent

Open
#1,483 0 comments 0 reactions 0 assignees View on GitHub
component:git-client-plugin component:github-api-plugin component:github-branch-source-plugin imported-jira-issue priority:major resolution:unresolved
Dominant language
Java
Stars
217
Forks
398
Avg merge
30m
Merged PRs (30d)
1

Description

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)

---
Originally reported by mgrochowalski, imported from: Different Proxy Configuration Between Controller and Agent


  • status: Open
  • priority: Major
  • component(s): git-client-plugin, github-api-plugin, github-branch-source-plugin
  • label(s): github, http, proxy
  • resolution: Unresolved
  • votes: 0
  • watchers: 1
  • imported: 2025-12-02

Raw content of original issue

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)

environment

```
Jenkins 2.378

GitHub API Plugin 1.318-461.v7a_c09c9fa_d63

GitHub Branch Source Plugin 1728.v859147241f49

Git client plugin 4.3.0
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.