I am using Jenkins using the Organization Folders plugin (latest version). I am able to do everything correctly when not using my corporate proxy on an open access point, so it shouldn't be a configuration problem, but I can't manage to make it work when going through the proxy. I traced down the problem to (I think) this plugin (I am not well versed in Java).

      I get the following error when trying to scan my organization:

      [Thu Feb 16 08:00:09 UTC 2017] Starting organization scan...
      [Thu Feb 16 08:00:09 UTC 2017] Updating actions...
      Looking up details of *****...
      It seems https://api.github.com is unreachable
      [Thu Feb 16 08:00:19 UTC 2017] Consulting GitHub Organization
      ERROR: [Thu Feb 16 08:00:29 UTC 2017] Could not fetch sources from navigator org.jenkinsci.plugins.github_branch_source.GitHubSCMNavigator@4cfaa276
      hudson.AbortException: It seems https://api.github.com is unreachable
      	at org.jenkinsci.plugins.github_branch_source.GitHubSCMNavigator.visitSources(GitHubSCMNavigator.java:268)
      	at jenkins.branch.OrganizationFolder.computeChildren(OrganizationFolder.java:400)
      	at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:219)
      	at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:141)
      	at jenkins.branch.OrganizationFolder$OrganizationScan.run(OrganizationFolder.java:851)
      	at hudson.model.ResourceController.execute(ResourceController.java:98)
      	at hudson.model.Executor.run(Executor.java:404)
      [Thu Feb 16 08:00:29 UTC 2017] Finished organization scan. Scan took 20 sec
      FATAL: It seems https://api.github.com is unreachable
      Finished: FAILURE
      

      I am almost certain that the proxy is correctly setup in Jenkins, Docker and host machine, as I can download plugins, make git checkouts and access https://api.github.com in the proxy validation test. I set -Djavax.net.debug=all for the container and while I can see a full trace when validating the proxy in Jenkins, I can only see the initialization of the SSL certificates truststore (just the first time) and then silence when https://api.github.com is accessed during the organization scan process.

      Any help would be welcomed. Thanks!

          [JENKINS-42089] Github API seems to ignore proxy

          Ryan Campbell added a comment -

          It looks like we correctly apply the proxy, so I'm not sure what could be going on here.

          However, if this is valid it seems quite severe, so i've bumped it up.

          Ryan Campbell added a comment - It looks like we correctly apply the proxy, so I'm not sure what could be going on here. However, if this is valid it seems quite severe, so i've bumped it up.

          I think I narrowed down the error to this issue in okHttp. I certainly looks like my problem, as I get the same wireshark data, and I also see the error using the Github-API plugin, which also uses okHttp.

          This issue seems to be fixed in okHttp3. Assuming I am right (which I am not certain) is there any chance to solve this from your side? Thanks!

          Guillermo Noain added a comment - I think I narrowed down the error to this issue in okHttp. I certainly looks like my problem, as I get the same wireshark data, and I also see the error using the Github-API plugin, which also uses okHttp. This issue seems to be fixed in okHttp3. Assuming I am right (which I am not certain) is there any chance to solve this from your side? Thanks!

          rsandell added a comment -

          I've verified that it works with squid proxy

          I had Jenkins in a docker container with an isolated network, the only host it could reach was the squid proxy server in another docker container attached to the same isolated network as well as the rest of the internet. And all the GitHub API calls works as well as anonymous git clones and pulls.

          rsandell added a comment - I've verified that it works with squid proxy I had Jenkins in a docker container with an isolated network, the only host it could reach was the squid proxy server in another docker container attached to the same isolated network as well as the rest of the internet. And all the GitHub API calls works as well as anonymous git clones and pulls.

          I guess there must be something related to my company proxy. Did you set an authenticated proxy? I can confirm that I have already solved my problem by making a custom build of the plugin using okhttp3.

          I would do a PR, but I know little Java and (don't tell anyone) I hardcoded the proxy credentials, as I don't know how to get them from the Jenkins proxy configuration

          Guillermo Noain added a comment - I guess there must be something related to my company proxy. Did you set an authenticated proxy? I can confirm that I have already solved my problem by making a custom build of the plugin using okhttp3. I would do a PR, but I know little Java and (don't tell anyone) I hardcoded the proxy credentials, as I don't know how to get them from the Jenkins proxy configuration

          Alexandre Touret added a comment - - edited

          I have the same behaviour . The proxy of my company is authenticated . The configuration works fine for git pull, proxy et such like.

          I can't reach GITHUB by both organization plugin job or in the jenkins configuration page. I also checked my configuration in a jenkins box which is not behind a corporate proxy. In this case, it works fine

           

          I always have the following error.

           

          Started by user }}{{MMMMMM[Wed Jun 28 11:30:18 CEST 2017] Starting organization scan... [Wed Jun 28 11:30:18 CEST 2017] Updating actions... Looking up details of MMMMMMM... ERROR: [Wed Jun 28 11:30:18 CEST 2017] Could not refresh actions for navigator org.jenkinsci.plugins.github_branch_source.GitHubSCMNavigator@4910dd6c org.kohsuke.github.HttpException: Server returned HTTP response code: -1, message: 'null' for URL: }}{{https://api.github.com/rate_limit{{ at org.kohsuke.github.Requester.parse(Requester.java:612) at org.kohsuke.github.Requester._to(Requester.java:262) at org.kohsuke.github.Requester.to(Requester.java:224) at org.kohsuke.github.GitHub.getRateLimit(GitHub.java:297) at org.kohsuke.github.GitHub.rateLimit(GitHub.java:349) at org.jenkinsci.plugins.github_branch_source.Connector.checkApiRateLimit(Connector.java:463) at org.jenkinsci.plugins.github_branch_source.GitHubSCMNavigator.retrieveActions(GitHubSCMNavigator.java:558) at jenkins.scm.api.SCMNavigator.fetchActions(SCMNavigator.java:315) at jenkins.branch.OrganizationFolder.computeChildren(OrganizationFolder.java:352) at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:266) at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:162) at jenkins.branch.OrganizationFolder$OrganizationScan.run(OrganizationFolder.java:852) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:405) Caused by: java.io.IOException: unexpected end of stream on null at com.squareup.okhttp.internal.http.Http1xStream.readResponse(Http1xStream.java:201) at com.squareup.okhttp.internal.io.RealConnection.createTunnel(RealConnection.java:270) at com.squareup.okhttp.internal.io.RealConnection.connectTls(RealConnection.java:172) at com.squareup.okhttp.internal.io.RealConnection.connectSocket(RealConnection.java:149) at com.squareup.okhttp.internal.io.RealConnection.connect(RealConnection.java:112) at com.squareup.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:184) at com.squareup.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:126) at com.squareup.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:95) at com.squareup.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:281) at com.squareup.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:224) at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:450) at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:399) at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:527) at com.squareup.okhttp.internal.huc.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:105) at com.squareup.okhttp.internal.huc.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:25) at org.kohsuke.github.Requester.parse(Requester.java:586) ... 13 more Caused by: java.io.EOFException: \n not found: size=0 content=... at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:201) at com.squareup.okhttp.internal.http.Http1xStream.readResponse(Http1xStream.java:186) ... 28 more [Wed Jun 28 11:30:18 CEST 2017] Consulting GitHub Organization ERROR: [Wed Jun 28 11:30:18 CEST 2017] Could not fetch sources from navigator org.jenkinsci.plugins.github_branch_source.GitHubSCMNavigator@4910dd6c hudson.AbortException: Invalid scan credentials LOGIN/****** (LOGIN) to connect to }}https://api.github.com, skipping at org.jenkinsci.plugins.github_branch_source.Connector.checkConnectionValidity(Connector.java:438) at org.jenkinsci.plugins.github_branch_source.GitHubSCMNavigator.visitSources(GitHubSCMNavigator.java:266) at jenkins.branch.OrganizationFolder.computeChildren(OrganizationFolder.java:401) at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:266) at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:162) at jenkins.branch.OrganizationFolder$OrganizationScan.run(OrganizationFolder.java:852) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:405) [Wed Jun 28 11:30:18 CEST 2017] Finished organization scan. Scan took 44 ms FATAL: Invalid scan credentials LOGIN/****** (LOGIN) to connect to }}{{https://api.github.com, skipping Finished: FAILURE

          Alexandre Touret added a comment - - edited I have the same behaviour . The proxy of my company is authenticated . The configuration works fine for git pull, proxy et such like. I can't reach GITHUB by both organization plugin job or in the jenkins configuration page. I also checked my configuration in a jenkins box which is not behind a corporate proxy. In this case, it works fine   I always have the following error.   Started by user }}{{ MMMMMM [Wed Jun 28 11:30:18 CEST 2017] Starting organization scan... [Wed Jun 28 11:30:18 CEST 2017] Updating actions... Looking up details of MMMMMMM... ERROR: [Wed Jun 28 11:30:18 CEST 2017] Could not refresh actions for navigator org.jenkinsci.plugins.github_branch_source.GitHubSCMNavigator@4910dd6c org.kohsuke.github.HttpException: Server returned HTTP response code: -1, message: 'null' for URL: }}{{ https://api.github.com/rate_limit {{ at org.kohsuke.github.Requester.parse(Requester.java:612) at org.kohsuke.github.Requester._to(Requester.java:262) at org.kohsuke.github.Requester.to(Requester.java:224) at org.kohsuke.github.GitHub.getRateLimit(GitHub.java:297) at org.kohsuke.github.GitHub.rateLimit(GitHub.java:349) at org.jenkinsci.plugins.github_branch_source.Connector.checkApiRateLimit(Connector.java:463) at org.jenkinsci.plugins.github_branch_source.GitHubSCMNavigator.retrieveActions(GitHubSCMNavigator.java:558) at jenkins.scm.api.SCMNavigator.fetchActions(SCMNavigator.java:315) at jenkins.branch.OrganizationFolder.computeChildren(OrganizationFolder.java:352) at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:266) at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:162) at jenkins.branch.OrganizationFolder$OrganizationScan.run(OrganizationFolder.java:852) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:405) Caused by: java.io.IOException: unexpected end of stream on null at com.squareup.okhttp.internal.http.Http1xStream.readResponse(Http1xStream.java:201) at com.squareup.okhttp.internal.io.RealConnection.createTunnel(RealConnection.java:270) at com.squareup.okhttp.internal.io.RealConnection.connectTls(RealConnection.java:172) at com.squareup.okhttp.internal.io.RealConnection.connectSocket(RealConnection.java:149) at com.squareup.okhttp.internal.io.RealConnection.connect(RealConnection.java:112) at com.squareup.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:184) at com.squareup.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:126) at com.squareup.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:95) at com.squareup.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:281) at com.squareup.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:224) at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:450) at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:399) at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:527) at com.squareup.okhttp.internal.huc.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:105) at com.squareup.okhttp.internal.huc.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:25) at org.kohsuke.github.Requester.parse(Requester.java:586) ... 13 more Caused by: java.io.EOFException: \n not found: size=0 content=... at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:201) at com.squareup.okhttp.internal.http.Http1xStream.readResponse(Http1xStream.java:186) ... 28 more [Wed Jun 28 11:30:18 CEST 2017] Consulting GitHub Organization ERROR: [Wed Jun 28 11:30:18 CEST 2017] Could not fetch sources from navigator org.jenkinsci.plugins.github_branch_source.GitHubSCMNavigator@4910dd6c hudson.AbortException: Invalid scan credentials LOGIN/****** (LOGIN) to connect to }} https://api.github.com , skipping at org.jenkinsci.plugins.github_branch_source.Connector.checkConnectionValidity(Connector.java:438) at org.jenkinsci.plugins.github_branch_source.GitHubSCMNavigator.visitSources(GitHubSCMNavigator.java:266) at jenkins.branch.OrganizationFolder.computeChildren(OrganizationFolder.java:401) at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:266) at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:162) at jenkins.branch.OrganizationFolder$OrganizationScan.run(OrganizationFolder.java:852) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:405) [Wed Jun 28 11:30:18 CEST 2017] Finished organization scan. Scan took 44 ms FATAL: Invalid scan credentials LOGIN/****** (LOGIN) to connect to }}{{ https://api.github.com , skipping Finished: FAILURE

          Liam Newman added a comment -

          Probably fixed sometime ago, but should definitely be fixed in gitub-branch-source 2.8.0

          Liam Newman added a comment - Probably fixed sometime ago, but should definitely be fixed in gitub-branch-source 2.8.0

            cloudbees CloudBees Inc.
            gnoain Guillermo Noain
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: