org.kohsuke.github.GHException: Failed to update jenkins hooks

Jenkins JIRA | Jesse Glick | 2 years ago
  1. 0

    When {{GitHubPushTrigger.start}} is run (generally because a job configuration was just saved), it forks a thread to update the web hooks. If there are any problems doing that, these are sent to the system log, but the person configuring the job may not know to look there (or may not even have permissions to do so). For example, I have gotten stack traces like {code:none} Failed to obtain repository com.cloudbees.jenkins.GitHubRepositoryName$1$1@... java.io.IOException: {"message":"Bad credentials","documentation_url":"https://developer.github.com/v3"} at org.kohsuke.github.Requester.handleApiError(Requester.java:427) at org.kohsuke.github.Requester._to(Requester.java:206) at org.kohsuke.github.Requester.to(Requester.java:160) at org.kohsuke.github.GitHub.getUser(GitHub.java:279) at com.cloudbees.jenkins.GitHubRepositoryName$1$1.adapt(GitHubRepositoryName.java:101) at com.cloudbees.jenkins.GitHubRepositoryName$1$1.adapt(GitHubRepositoryName.java:98) at hudson.util.AdaptedIterator.next(AdaptedIterator.java:54) at hudson.util.Iterators$FilterIterator.fetch(Iterators.java:109) at hudson.util.Iterators$FilterIterator.hasNext(Iterators.java:127) at com.cloudbees.jenkins.GitHubPushTrigger$2.run(GitHubPushTrigger.java:144) at ... Caused by: java.io.IOException: Server returned HTTP response code: 401 for URL: https://api.github.com/users/<myorg> at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source) at org.kohsuke.github.Requester.parse(Requester.java:383) at org.kohsuke.github.Requester._to(Requester.java:185) ... 16 more {code} and later on the same job {code:none} org.kohsuke.github.GHException: Failed to update jenkins hooks at com.cloudbees.jenkins.GitHubPushTrigger.createJenkinsHook(GitHubPushTrigger.java:164) at com.cloudbees.jenkins.GitHubPushTrigger.access$700(GitHubPushTrigger.java:46) at com.cloudbees.jenkins.GitHubPushTrigger$2.run(GitHubPushTrigger.java:146) at ... Caused by: java.io.FileNotFoundException: https://api.github.com/repos/<myorg>/<myrepo>/hooks at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source) at org.kohsuke.github.Requester.parse(Requester.java:383) at org.kohsuke.github.Requester._to(Requester.java:185) at org.kohsuke.github.Requester.to(Requester.java:160) at org.kohsuke.github.GHRepository.createHook(GHRepository.java:754) at com.cloudbees.jenkins.GitHubPushTrigger.createJenkinsHook(GitHubPushTrigger.java:161) ... 10 more {code} By the time these are thrown, it is of course too late to display such errors on the configuration page for the job now, but I would suggest that form validation for the push trigger display any such errors from the _last_ save. (If you are not getting builds triggered, your natural first step would be to double-check the job configuration, where you would see this clearly.)

    Jenkins JIRA | 2 years ago | Jesse Glick
    org.kohsuke.github.GHException: Failed to update jenkins hooks
  2. 0

    When {{GitHubPushTrigger.start}} is run (generally because a job configuration was just saved), it forks a thread to update the web hooks. If there are any problems doing that, these are sent to the system log, but the person configuring the job may not know to look there (or may not even have permissions to do so). For example, I have gotten stack traces like {code:none} Failed to obtain repository com.cloudbees.jenkins.GitHubRepositoryName$1$1@... java.io.IOException: {"message":"Bad credentials","documentation_url":"https://developer.github.com/v3"} at org.kohsuke.github.Requester.handleApiError(Requester.java:427) at org.kohsuke.github.Requester._to(Requester.java:206) at org.kohsuke.github.Requester.to(Requester.java:160) at org.kohsuke.github.GitHub.getUser(GitHub.java:279) at com.cloudbees.jenkins.GitHubRepositoryName$1$1.adapt(GitHubRepositoryName.java:101) at com.cloudbees.jenkins.GitHubRepositoryName$1$1.adapt(GitHubRepositoryName.java:98) at hudson.util.AdaptedIterator.next(AdaptedIterator.java:54) at hudson.util.Iterators$FilterIterator.fetch(Iterators.java:109) at hudson.util.Iterators$FilterIterator.hasNext(Iterators.java:127) at com.cloudbees.jenkins.GitHubPushTrigger$2.run(GitHubPushTrigger.java:144) at ... Caused by: java.io.IOException: Server returned HTTP response code: 401 for URL: https://api.github.com/users/<myorg> at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source) at org.kohsuke.github.Requester.parse(Requester.java:383) at org.kohsuke.github.Requester._to(Requester.java:185) ... 16 more {code} and later on the same job {code:none} org.kohsuke.github.GHException: Failed to update jenkins hooks at com.cloudbees.jenkins.GitHubPushTrigger.createJenkinsHook(GitHubPushTrigger.java:164) at com.cloudbees.jenkins.GitHubPushTrigger.access$700(GitHubPushTrigger.java:46) at com.cloudbees.jenkins.GitHubPushTrigger$2.run(GitHubPushTrigger.java:146) at ... Caused by: java.io.FileNotFoundException: https://api.github.com/repos/<myorg>/<myrepo>/hooks at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source) at org.kohsuke.github.Requester.parse(Requester.java:383) at org.kohsuke.github.Requester._to(Requester.java:185) at org.kohsuke.github.Requester.to(Requester.java:160) at org.kohsuke.github.GHRepository.createHook(GHRepository.java:754) at com.cloudbees.jenkins.GitHubPushTrigger.createJenkinsHook(GitHubPushTrigger.java:161) ... 10 more {code} By the time these are thrown, it is of course too late to display such errors on the configuration page for the job now, but I would suggest that form validation for the push trigger display any such errors from the _last_ save. (If you are not getting builds triggered, your natural first step would be to double-check the job configuration, where you would see this clearly.)

    Jenkins JIRA | 2 years ago | Jesse Glick
    org.kohsuke.github.GHException: Failed to update jenkins hooks
  3. 0

    [JIRA] [github-plugin] (JENKINS-33908) github plugin generates lots of undesired threaddumps on recreate webhooks

    Google Groups | 8 months ago | sorin....@gmail.com (JIRA)
    org.kohsuke.github.GHException: Failed to delete post-commit hook
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.kohsuke.github.GHException

      Failed to update jenkins hooks

      at com.cloudbees.jenkins.GitHubPushTrigger.createJenkinsHook()
    2. com.cloudbees.jenkins
      GitHubPushTrigger$2.run
      1. com.cloudbees.jenkins.GitHubPushTrigger.createJenkinsHook(GitHubPushTrigger.java:164)
      2. com.cloudbees.jenkins.GitHubPushTrigger.access$700(GitHubPushTrigger.java:46)
      3. com.cloudbees.jenkins.GitHubPushTrigger$2.run(GitHubPushTrigger.java:146)
      3 frames