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

Events handling for deleted branches can blow up

    Details

    • Type: Bug
    • Status: In Review
    • Priority: Major
    • Resolution: Unresolved
    • Labels:
      None
    • Environment:
      Jenkins 2.74
      Branch API Plugin 2.0.11
      GitHub Branch Source Plugin 2.2.3
    • Similar Issues:

      Description

      Hi,

      In a multibranch pipeline job configured with GitHub repository, when a branch was deleted in GitHub and respective event is processed in Jenkins, that branch is not marked as dead in a 'Branches' view any longer.

      Related snippet from the Repository Events log is below.

      At a glance, when fetching branch data for all branches of interest, an exception is thrown for deleted branches which causes processing to stop.

      In turn, the branch info is fetched during lazy iteration here.

      Not sure if this issue should be filed against GItHub Branch Source Plugin or this one, because event though the exception is thrown from downstream, on the upstream level it sounds odd to fetch data for the branch just deleted. However I don't know the plugin innards well enough to speculate here.

      [Fri Aug 18 06:18:59 PDT 2017] Received Push event to branch non-buildable-branch in repository me/pipelineTrigger REMOVED event from 10.254.180.205 ⇒ http://my.host.com:9090/github-webhook/ with timestamp Fri Aug 18 06:18:54 PDT 2017
      06:18:59 Connecting to https://github.com/api/v3 using me/****** (GitHub OAuth token)
      Examining me/pipelineTrigger
      
        Checking branches...
      
        Getting remote branch non-buildable-branch...
      ERROR: {"message":"Branch not found","documentation_url":"https://developer.github.com/enterprise/2.9/v3/repos/#get-branch"}
      java.io.FileNotFoundException: https://github.com/api/v3/repos/me/pipelineTrigger/branches/non-buildable-branch
      	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/enterprise/2.9/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.processHeadUpdate(MultiBranchProject.java:1543)
      	at jenkins.branch.MultiBranchProject$SCMEventListenerImpl.onSCMHeadEvent(MultiBranchProject.java:1144)
      	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 Aug 18 06:18:59 PDT 2017] Push event to branch non-buildable-branch in repository me/pipelineTrigger REMOVED event from 10.254.180.205 ⇒ http://my.host.com:9090/github-webhook/ with timestamp Fri Aug 18 06:18:54 PDT 2017 processed in 0.47 sec

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                stephenconnolly Stephen Connolly
                Reporter:
                anenviousguest Vladislav Ponomarev
              • Votes:
                1 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated: