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

Github Api Events Produce Error If Branch Name Contains #

XMLWordPrintable

      I am using Github Organization to manage my Jenkins projects. I keep getting reports about Jenkins not picking up jobs for push events.  I did notice that every time I scanned the repo everything was picked up just fine but for some reason web hooks were failing. I check the failing projects Repository Events and found all branches with # in the name were causing events to fail. 

       

      Here is a trace from a test I created:

      --------------------------------------------------------

      [Fri Sep 15 14:22:29 UTC 2017] Received Push event to branch feature/#JenkinsTest in repository XXXXXXXX/XXXXXXXXXX CREATED event from ⇒ https://XXXXXX.XXXXXXX.XXX/github-webhook/ with timestamp Fri Sep 15 14:22:24 UTC 2017
      [Fri Sep 15 14:22:29 UTC 2017] Received Push event to branch feature/#JenkinsTest in repository XXXXXXXX/XXXXXXXXXX CREATED event from ⇒ https://XXXXX.XXXXXXX.XXX/github-webhook/ with timestamp Fri Sep 15 14:22:24 UTC 2017
      Examining XXXXXXXX/XXXXXXXXXX

      Checking branches...

      Getting remote branch feature/#JenkinsTest...
      ERROR:

      {"message":"Branch not found","documentation_url":"https://developer.github.com/v3/repos/#get-branch"}

      java.io.FileNotFoundException: https://api.github.com/repos/XXXXXXXX/XXXXXXXXXX/branches/feature/#JenkinsTest
      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:602)
      at org.kohsuke.github.Requester.parse(Requester.java:584)
      at org.kohsuke.github.Requester._to(Requester.java:264)
      Caused: java.io.FileNotFoundException:

      {"message":"Branch not found","documentation_url":"https://developer.github.com/v3/repos/#get-branch"}

      at org.kohsuke.github.Requester.handleApiError(Requester.java:660)
      at org.kohsuke.github.Requester._to(Requester.java:285)
      at org.kohsuke.github.Requester.to(Requester.java:226)
      at org.kohsuke.github.GHRepository.getBranch(GHRepository.java:1234)
      at org.jenkinsci.plugins.github_branch_source.GitHubSCMSource$LazyBranches.create(GitHubSCMSource.java:1773)
      at org.jenkinsci.plugins.github_branch_source.LazyIterable.iterator(LazyIterable.java:57)
      at org.jenkinsci.plugins.github_branch_source.GitHubSCMSource.retrieve(GitHubSCMSource.java:869)
      at jenkins.scm.api.SCMSource._retrieve(SCMSource.java:355)
      at jenkins.scm.api.SCMSource.fetch(SCMSource.java:309)
      at jenkins.branch.MultiBranchProject$SCMEventListenerImpl.processHeadCreate(MultiBranchProject.java:1300)
      at jenkins.branch.MultiBranchProject$SCMEventListenerImpl.onSCMHeadEvent(MultiBranchProject.java:1134)
      at jenkins.scm.api.SCMHeadEvent$DispatcherImpl.fire(SCMHeadEvent.java:247)
      at jenkins.scm.api.SCMHeadEvent$DispatcherImpl.fire(SCMHeadEvent.java:230)
      at jenkins.scm.api.SCMEvent$Dispatcher.run(SCMEvent.java:481)
      at jenkins.security.ImpersonatingScheduledExecutorService$1.run(ImpersonatingScheduledExecutorService.java:58)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      at java.lang.Thread.run(Thread.java:748)
      [Fri Sep 15 14:22:30 UTC 2017] Push event to branch feature/#JenkinsTest in repository XXXXXXXX/XXXXXXXXXX CREATED event from ⇒ https://XXXXX.XXXXXXX.XXX/github-webhook/ with timestamp Fri Sep 15 14:22:24 UTC 2017 processed in 0.34 sec

       

            Unassigned Unassigned
            justinp Justin Pullen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: