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

GitHub Organization scanning fails abnormally when user is blocked from repositories

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    •  github-branch-source 2.0.6

      We recently "archived" a number of GitHub repos in one of our organizations. Every repository that was archived is no longer accessible by our scan user, resulting in a very nasty stacktrace (halting scanning).

       

      Proposing repository
      ERROR: [Mon Jul 03 14:09:26 CDT 2017] Could not fetch sources from navigator org.jenkinsci.plugins.github_branch_source.GitHubSCMNavigator@2136caad
      java.io.FileNotFoundException: {"message":"Repository access blocked","block":{"reason":"admin","created_at":"2017-06-29T08:11:26-05:00","html_url":"https://help.github.com/enterprise/2.10/admin/guides/installation/troubleshooting/"}}
      	at org.kohsuke.github.Requester.handleApiError(Requester.java:650)
      	at org.kohsuke.github.Requester._to(Requester.java:283)
      	at org.kohsuke.github.Requester.to(Requester.java:224)
      	at org.kohsuke.github.GitHub.getRepository(GitHub.java:420)
      	at org.jenkinsci.plugins.github_branch_source.GitHubSCMSource.retrieve(GitHubSCMSource.java:457)
      	at jenkins.scm.api.SCMSource._retrieve(SCMSource.java:300)
      	at jenkins.scm.api.SCMSource.fetch(SCMSource.java:254)
      	at jenkins.branch.MultiBranchProjectFactory$BySCMSourceCriteria.recognizes(MultiBranchProjectFactory.java:263)
      	at jenkins.branch.OrganizationFolder$SCMSourceObserverImpl$1.recognizes(OrganizationFolder.java:1274)
      	at jenkins.branch.OrganizationFolder$SCMSourceObserverImpl$1.complete(OrganizationFolder.java:1289)
      	at org.jenkinsci.plugins.github_branch_source.GitHubSCMNavigator.add(GitHubSCMNavigator.java:540)
      	at org.jenkinsci.plugins.github_branch_source.GitHubSCMNavigator.visitSources(GitHubSCMNavigator.java:362)
      	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:97)
      	at hudson.model.Executor.run(Executor.java:405)
      Caused by: java.io.FileNotFoundException: https://github.domain.com/api/v3/repos/ORGANIZATION/repository
      	at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:243)
      	at com.squareup.okhttp.internal.huc.DelegatingHttpsURLConnection.getInputStream(DelegatingHttpsURLConnection.java:210)
      	at com.squareup.okhttp.internal.huc.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:25)
      	at org.kohsuke.github.Requester.parse(Requester.java:596)
      	at org.kohsuke.github.Requester._to(Requester.java:262)
      	... 16 more
      [Mon Jul 03 14:09:26 CDT 2017] Finished organization scan. Scan took 1.9 sec
      FATAL: Failed to recompute children of ORGANIZATION
      java.io.FileNotFoundException: {"message":"Repository access blocked","block":{"reason":"admin","created_at":"2017-06-29T08:11:26-05:00","html_url":"https://help.github.com/enterprise/2.10/admin/guides/installation/troubleshooting/"}}
      	at org.kohsuke.github.Requester.handleApiError(Requester.java:650)
      	at org.kohsuke.github.Requester._to(Requester.java:283)
      	at org.kohsuke.github.Requester.to(Requester.java:224)
      	at org.kohsuke.github.GitHub.getRepository(GitHub.java:420)
      	at org.jenkinsci.plugins.github_branch_source.GitHubSCMSource.retrieve(GitHubSCMSource.java:457)
      	at jenkins.scm.api.SCMSource._retrieve(SCMSource.java:300)
      	at jenkins.scm.api.SCMSource.fetch(SCMSource.java:254)
      	at jenkins.branch.MultiBranchProjectFactory$BySCMSourceCriteria.recognizes(MultiBranchProjectFactory.java:263)
      	at jenkins.branch.OrganizationFolder$SCMSourceObserverImpl$1.recognizes(OrganizationFolder.java:1274)
      	at jenkins.branch.OrganizationFolder$SCMSourceObserverImpl$1.complete(OrganizationFolder.java:1289)
      	at org.jenkinsci.plugins.github_branch_source.GitHubSCMNavigator.add(GitHubSCMNavigator.java:540)
      	at org.jenkinsci.plugins.github_branch_source.GitHubSCMNavigator.visitSources(GitHubSCMNavigator.java:362)
      	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:97)
      	at hudson.model.Executor.run(Executor.java:405)
      Caused by: java.io.FileNotFoundException: https://github.domain.com/api/v3/repos/ORGANIZATION/repository
      	at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:243)
      	at com.squareup.okhttp.internal.huc.DelegatingHttpsURLConnection.getInputStream(DelegatingHttpsURLConnection.java:210)
      	at com.squareup.okhttp.internal.huc.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:25)
      	at org.kohsuke.github.Requester.parse(Requester.java:596)
      	at org.kohsuke.github.Requester._to(Requester.java:262)
      	... 16 more

      My current workaround is to specifically ignore these repositories in my organization filter. It at least ignores them gracefully.

            Unassigned Unassigned
            rpocase Robby Pocase
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: