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

Inactive PRs break Branch Indexing

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • None
    • Jenkins:2.60.1
      github-branch-source:2.0.6

      When a repo has an open PR that originates from a deleted fork, GitHub does not automatically remove the PR. Therefore you end up with something like the following, an unknown repository:

      And this breaks the branch indexing:

      Looking up test-org-2/50579
      
        Getting remote pull requests...
      
          Checking pull request #1
      ERROR: [Tue Jul 04 06:31:43 UTC 2017] Could not fetch branches from source ffecb3b1-5acc-48ae-80d7-daafa2ed99ca
      java.lang.NullPointerException
      	at org.jenkinsci.plugins.github_branch_source.GitHubSCMSource.doRetrieve(GitHubSCMSource.java:623)
      	at org.jenkinsci.plugins.github_branch_source.GitHubSCMSource.retrieve(GitHubSCMSource.java:462)
      	at jenkins.scm.api.SCMSource._retrieve(SCMSource.java:300)
      	at jenkins.scm.api.SCMSource.fetch(SCMSource.java:210)
      	at jenkins.branch.MultiBranchProject.computeChildren(MultiBranchProject.java:630)
      	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.MultiBranchProject$BranchIndexing.run(MultiBranchProject.java:969)
      	at hudson.model.ResourceController.execute(ResourceController.java:97)
      	at hudson.model.Executor.run(Executor.java:405)
      [Tue Jul 04 06:31:43 UTC 2017] Finished branch indexing. Indexing took 0.45 sec
      FATAL: Failed to recompute children of aburdajewicz ยป test50579
      java.lang.NullPointerException
      	at org.jenkinsci.plugins.github_branch_source.GitHubSCMSource.doRetrieve(GitHubSCMSource.java:623)
      	at org.jenkinsci.plugins.github_branch_source.GitHubSCMSource.retrieve(GitHubSCMSource.java:462)
      	at jenkins.scm.api.SCMSource._retrieve(SCMSource.java:300)
      	at jenkins.scm.api.SCMSource.fetch(SCMSource.java:210)
      	at jenkins.branch.MultiBranchProject.computeChildren(MultiBranchProject.java:630)
      	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.MultiBranchProject$BranchIndexing.run(MultiBranchProject.java:969)
      	at hudson.model.ResourceController.execute(ResourceController.java:97)
      	at hudson.model.Executor.run(Executor.java:405)
      Finished: FAILURE
      

      Why PR are not automatically deleted? Probably because in GitHub, an inactive PR can still be merged: https://help.github.com/articles/checking-out-pull-requests-locally/#modifying-an-inactive-pull-request-locally.

      The only way to have branch indexing work again is to ensure you don't have any inactive PR.

      How to reproduce

      • Create a repo in an GH organization
      • Create a fork in a different account
      • Open a PR from the fork to the original repo
      • Trigger branch indexing (branches and PRs are retrieved)
      • Delete the fork
      • Trigger branch indexing -> it fails with an NPE

        1. obsolete-pr.png
          21 kB
          Allan BURDAJEWICZ

            Unassigned Unassigned
            allan_burdajewicz Allan BURDAJEWICZ
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: