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

Report failures to attach hook in UI

    Details

    • Similar Issues:

      Description

      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

      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
      

      and later on the same job

      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
      

      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.)

        Attachments

          Issue Links

            Activity

            Hide
            lanwen Kirill Merkushev added a comment -

            We need a global state where we can save such warning. I propose AdministrativeMonitor, where WebHookManager can register failure for job, and where form validation can check existance of the job in such monitor

            Show
            lanwen Kirill Merkushev added a comment - We need a global state where we can save such warning. I propose AdministrativeMonitor, where WebHookManager can register failure for job, and where form validation can check existance of the job in such monitor
            Show
            lanwen Kirill Merkushev added a comment - Implementation: https://github.com/jenkinsci/github-plugin/pull/106
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Kirill Merkushev
            Path:
            .gitignore
            pom.xml
            src/main/java/com/cloudbees/jenkins/GitHubPushTrigger.java
            src/main/java/org/jenkinsci/plugins/github/admin/GHRepoName.java
            src/main/java/org/jenkinsci/plugins/github/admin/GitHubHookRegisterProblemMonitor.java
            src/main/java/org/jenkinsci/plugins/github/admin/RequireAdminRights.java
            src/main/java/org/jenkinsci/plugins/github/admin/RespondWithRedirect.java
            src/main/java/org/jenkinsci/plugins/github/admin/ValidateRepoName.java
            src/main/java/org/jenkinsci/plugins/github/webhook/RequirePostWithGHHookPayload.java
            src/main/java/org/jenkinsci/plugins/github/webhook/WebhookManager.java
            src/main/java/org/jenkinsci/plugins/github/webhook/subscriber/PingGHEventSubscriber.java
            src/main/resources/com/cloudbees/jenkins/GitHubPushTrigger/config.groovy
            src/main/resources/com/cloudbees/jenkins/GitHubPushTrigger/help.html
            src/main/resources/org/jenkinsci/plugins/github/Messages.properties
            src/main/resources/org/jenkinsci/plugins/github/admin/GitHubHookRegisterProblemMonitor/index.groovy
            src/main/resources/org/jenkinsci/plugins/github/admin/GitHubHookRegisterProblemMonitor/index.properties
            src/main/resources/org/jenkinsci/plugins/github/admin/GitHubHookRegisterProblemMonitor/message.groovy
            src/main/resources/org/jenkinsci/plugins/github/admin/GitHubHookRegisterProblemMonitor/message.properties
            src/main/sass/monitor.scss
            src/main/webapp/img/logo.svg
            src/main/webapp/js/warning.js
            src/test/java/com/cloudbees/jenkins/GitHubPushTriggerTest.java
            src/test/java/org/jenkinsci/plugins/github/admin/GHRepoNameTest.java
            src/test/java/org/jenkinsci/plugins/github/admin/GitHubHookRegisterProblemMonitorTest.java
            src/test/java/org/jenkinsci/plugins/github/admin/ValidateRepoNameTest.java
            src/test/java/org/jenkinsci/plugins/github/webhook/subscriber/PingGHEventSubscriberTest.java
            src/test/resources/org/jenkinsci/plugins/github/admin/GitHubHookRegisterProblemMonitorTest/shouldLoadIgnoredList/config.xml
            src/test/resources/org/jenkinsci/plugins/github/admin/GitHubHookRegisterProblemMonitorTest/shouldLoadIgnoredList/org.jenkinsci.plugins.github.admin.GitHubHookRegisterProblemMonitor.xml
            http://jenkins-ci.org/commit/github-plugin/bda9cc0c37dc557d9a1e6e2cbd1684eee205c25d
            Log:
            [FIXES JENKINS-24690] Administrative monitor to show hook registering problems

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Kirill Merkushev Path: .gitignore pom.xml src/main/java/com/cloudbees/jenkins/GitHubPushTrigger.java src/main/java/org/jenkinsci/plugins/github/admin/GHRepoName.java src/main/java/org/jenkinsci/plugins/github/admin/GitHubHookRegisterProblemMonitor.java src/main/java/org/jenkinsci/plugins/github/admin/RequireAdminRights.java src/main/java/org/jenkinsci/plugins/github/admin/RespondWithRedirect.java src/main/java/org/jenkinsci/plugins/github/admin/ValidateRepoName.java src/main/java/org/jenkinsci/plugins/github/webhook/RequirePostWithGHHookPayload.java src/main/java/org/jenkinsci/plugins/github/webhook/WebhookManager.java src/main/java/org/jenkinsci/plugins/github/webhook/subscriber/PingGHEventSubscriber.java src/main/resources/com/cloudbees/jenkins/GitHubPushTrigger/config.groovy src/main/resources/com/cloudbees/jenkins/GitHubPushTrigger/help.html src/main/resources/org/jenkinsci/plugins/github/Messages.properties src/main/resources/org/jenkinsci/plugins/github/admin/GitHubHookRegisterProblemMonitor/index.groovy src/main/resources/org/jenkinsci/plugins/github/admin/GitHubHookRegisterProblemMonitor/index.properties src/main/resources/org/jenkinsci/plugins/github/admin/GitHubHookRegisterProblemMonitor/message.groovy src/main/resources/org/jenkinsci/plugins/github/admin/GitHubHookRegisterProblemMonitor/message.properties src/main/sass/monitor.scss src/main/webapp/img/logo.svg src/main/webapp/js/warning.js src/test/java/com/cloudbees/jenkins/GitHubPushTriggerTest.java src/test/java/org/jenkinsci/plugins/github/admin/GHRepoNameTest.java src/test/java/org/jenkinsci/plugins/github/admin/GitHubHookRegisterProblemMonitorTest.java src/test/java/org/jenkinsci/plugins/github/admin/ValidateRepoNameTest.java src/test/java/org/jenkinsci/plugins/github/webhook/subscriber/PingGHEventSubscriberTest.java src/test/resources/org/jenkinsci/plugins/github/admin/GitHubHookRegisterProblemMonitorTest/shouldLoadIgnoredList/config.xml src/test/resources/org/jenkinsci/plugins/github/admin/GitHubHookRegisterProblemMonitorTest/shouldLoadIgnoredList/org.jenkinsci.plugins.github.admin.GitHubHookRegisterProblemMonitor.xml http://jenkins-ci.org/commit/github-plugin/bda9cc0c37dc557d9a1e6e2cbd1684eee205c25d Log: [FIXES JENKINS-24690] Administrative monitor to show hook registering problems
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Merkushev Kirill
            Path:
            .gitignore
            pom.xml
            src/main/java/com/cloudbees/jenkins/GitHubPushTrigger.java
            src/main/java/org/jenkinsci/plugins/github/admin/GHRepoName.java
            src/main/java/org/jenkinsci/plugins/github/admin/GitHubHookRegisterProblemMonitor.java
            src/main/java/org/jenkinsci/plugins/github/admin/RequireAdminRights.java
            src/main/java/org/jenkinsci/plugins/github/admin/RespondWithRedirect.java
            src/main/java/org/jenkinsci/plugins/github/admin/ValidateRepoName.java
            src/main/java/org/jenkinsci/plugins/github/webhook/RequirePostWithGHHookPayload.java
            src/main/java/org/jenkinsci/plugins/github/webhook/WebhookManager.java
            src/main/java/org/jenkinsci/plugins/github/webhook/subscriber/PingGHEventSubscriber.java
            src/main/resources/com/cloudbees/jenkins/GitHubPushTrigger/config.groovy
            src/main/resources/com/cloudbees/jenkins/GitHubPushTrigger/help.html
            src/main/resources/org/jenkinsci/plugins/github/Messages.properties
            src/main/resources/org/jenkinsci/plugins/github/admin/GitHubHookRegisterProblemMonitor/index.groovy
            src/main/resources/org/jenkinsci/plugins/github/admin/GitHubHookRegisterProblemMonitor/index.properties
            src/main/resources/org/jenkinsci/plugins/github/admin/GitHubHookRegisterProblemMonitor/message.groovy
            src/main/resources/org/jenkinsci/plugins/github/admin/GitHubHookRegisterProblemMonitor/message.properties
            src/main/sass/monitor.scss
            src/main/webapp/img/logo.svg
            src/main/webapp/js/warning.js
            src/test/java/com/cloudbees/jenkins/GitHubPushTriggerTest.java
            src/test/java/org/jenkinsci/plugins/github/admin/GHRepoNameTest.java
            src/test/java/org/jenkinsci/plugins/github/admin/GitHubHookRegisterProblemMonitorTest.java
            src/test/java/org/jenkinsci/plugins/github/admin/ValidateRepoNameTest.java
            src/test/java/org/jenkinsci/plugins/github/webhook/subscriber/PingGHEventSubscriberTest.java
            src/test/resources/org/jenkinsci/plugins/github/admin/GitHubHookRegisterProblemMonitorTest/shouldLoadIgnoredList/config.xml
            src/test/resources/org/jenkinsci/plugins/github/admin/GitHubHookRegisterProblemMonitorTest/shouldLoadIgnoredList/org.jenkinsci.plugins.github.admin.GitHubHookRegisterProblemMonitor.xml
            http://jenkins-ci.org/commit/github-plugin/c0b718efa3ca4d300fac5cdffc0f694b2d929921
            Log:
            Merge pull request #106 from lanwen/hook_monitor

            [FIXES JENKINS-24690] Administrative monitor to show hook registering…

            Compare: https://github.com/jenkinsci/github-plugin/compare/5bd034e864ca...c0b718efa3ca

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Merkushev Kirill Path: .gitignore pom.xml src/main/java/com/cloudbees/jenkins/GitHubPushTrigger.java src/main/java/org/jenkinsci/plugins/github/admin/GHRepoName.java src/main/java/org/jenkinsci/plugins/github/admin/GitHubHookRegisterProblemMonitor.java src/main/java/org/jenkinsci/plugins/github/admin/RequireAdminRights.java src/main/java/org/jenkinsci/plugins/github/admin/RespondWithRedirect.java src/main/java/org/jenkinsci/plugins/github/admin/ValidateRepoName.java src/main/java/org/jenkinsci/plugins/github/webhook/RequirePostWithGHHookPayload.java src/main/java/org/jenkinsci/plugins/github/webhook/WebhookManager.java src/main/java/org/jenkinsci/plugins/github/webhook/subscriber/PingGHEventSubscriber.java src/main/resources/com/cloudbees/jenkins/GitHubPushTrigger/config.groovy src/main/resources/com/cloudbees/jenkins/GitHubPushTrigger/help.html src/main/resources/org/jenkinsci/plugins/github/Messages.properties src/main/resources/org/jenkinsci/plugins/github/admin/GitHubHookRegisterProblemMonitor/index.groovy src/main/resources/org/jenkinsci/plugins/github/admin/GitHubHookRegisterProblemMonitor/index.properties src/main/resources/org/jenkinsci/plugins/github/admin/GitHubHookRegisterProblemMonitor/message.groovy src/main/resources/org/jenkinsci/plugins/github/admin/GitHubHookRegisterProblemMonitor/message.properties src/main/sass/monitor.scss src/main/webapp/img/logo.svg src/main/webapp/js/warning.js src/test/java/com/cloudbees/jenkins/GitHubPushTriggerTest.java src/test/java/org/jenkinsci/plugins/github/admin/GHRepoNameTest.java src/test/java/org/jenkinsci/plugins/github/admin/GitHubHookRegisterProblemMonitorTest.java src/test/java/org/jenkinsci/plugins/github/admin/ValidateRepoNameTest.java src/test/java/org/jenkinsci/plugins/github/webhook/subscriber/PingGHEventSubscriberTest.java src/test/resources/org/jenkinsci/plugins/github/admin/GitHubHookRegisterProblemMonitorTest/shouldLoadIgnoredList/config.xml src/test/resources/org/jenkinsci/plugins/github/admin/GitHubHookRegisterProblemMonitorTest/shouldLoadIgnoredList/org.jenkinsci.plugins.github.admin.GitHubHookRegisterProblemMonitor.xml http://jenkins-ci.org/commit/github-plugin/c0b718efa3ca4d300fac5cdffc0f694b2d929921 Log: Merge pull request #106 from lanwen/hook_monitor [FIXES JENKINS-24690] Administrative monitor to show hook registering… Compare: https://github.com/jenkinsci/github-plugin/compare/5bd034e864ca...c0b718efa3ca
            Hide
            lanwen Kirill Merkushev added a comment -

            released as 1.17.0

            Show
            lanwen Kirill Merkushev added a comment - released as 1.17.0

              People

              • Assignee:
                lanwen Kirill Merkushev
                Reporter:
                jglick Jesse Glick
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: