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

FATAL: Error while retrieving pull request merge hash : org.kohsuke.github.HttpException

XMLWordPrintable

      Hello there,

      we facing an issue after updating our GitHub Enterprise Server to 3.4.1 yesterday.

      We have about 100 Jenkins Instances - deployed as Pods in kubernetes - with the same basic configuration and plugins and one which has a special configuration, cause the organisation uses submodule, i will talk about this later.

      The Problem appears only on this one special Instance and we can not locate why.

      The Error appears during the repo-scan, while retrieving the hash of an open pull request.
      Repo-Scan Log:

      [...]
        23 branches were processed
      
        Checking pull-requests...
      
        Getting remote pull requests...
      
          Checking pull request #2693
            'Jenkinsfile' found
      
      ERROR: [Wed Apr 27 10:49:39 CEST 2022] Could not fetch branches from source org.jenkinsci.plugins.github_branch_source.GitHubSCMNavigator::https://github.mycompany.de/api/v3::<my-github-org>::<repo>
      [Wed Apr 27 10:49:39 CEST 2022] Finished branch indexing. Indexing took 3.4 sec
      FATAL: Error while retrieving pull request 2693 merge hash : org.kohsuke.github.HttpException: 
      Finished: FAILURE

      > Organisation and Repo with dummy values replaced.
      There is no further Stacktrace or Log this is the only information about the error we got. So we are completly stucked at the moment. And requesting some help, to understand whats happing.

      The special Instance has two SSH-Agent-Slaves and a additional SCMTrait for Submodules. Normally the builds on our cloudbased Jenkins (we call it Leeroy ) spawns a Pod where the artifacts will be build. The special Instance is only using the slaves.

      May be another detail: The Repos in this organisation are mostly "private" and some of the repos has more than >6000 Commits. They are really large.

      Can someone explain, whats happing in the step of retriving the pr-hash?

      Some more details:

      For the Auth between GitHub ES and Jenkins, we use an GitHub App with the following access:
      > Read access to members, metadata, and pull requests 
      > Read and write access to checks, code, and commit statuses 
      > Repository access: All repositories

      We configure our github-plugin during startup in a Groovy Script:

       def scmNavigator = new GitHubSCMNavigator(githubApiUrl, organizationName, github_credential, github_credential)
              
              
                            scmNavigator.setTraits([
              
              
                                new BranchDiscoveryTrait(true, true), // build ALL branches
              
              
                                new OriginPullRequestDiscoveryTrait(1), // build PR-Merge on Pull Requests
              
              
                                new ForkPullRequestDiscoveryTrait(1, new ForkPullRequestDiscoveryTrait.TrustPermission()), // only build PR-Merge of users with write access to the repository
              
              
                                new jenkins.plugins.git.traits.LocalBranchTrait(), // check out target branch
              
              
                                new jenkins.plugins.git.traits.GitLFSPullTrait(), // perform git lfs pull after clone
              
              
                                new jenkins.plugins.git.traits.CleanAfterCheckoutTrait(), // perform clean after checkout
              
              
                                new jenkins.plugins.git.traits.RefSpecsSCMSourceTrait( // add ref specs for HEAD and tags
              
              
                                    "+refs/heads/*:refs/remotes/@{remote}/*",
              
              
                                    "+refs/tags/*:refs/tags/*"
              
              
                                ),
              
              
                                new jenkins.scm.impl.trait.WildcardSCMSourceFilterTrait(
              
              
                                    config.init.GIT_REPO_INCLUDES ?: "*",
              
              
                                    config.init.GIT_REPO_EXCLUDES ?: ""
              
              
                                ),
              
              
                                new jenkins.scm.impl.trait.WildcardSCMHeadFilterTrait(
              
              
                                    config.init.GIT_BRANCH_INCLUDES ?: "*",
              
              
                                    config.init.GIT_BRANCH_EXCLUDES ?: ""
              
              
                                )
              
              
                            ]);
              
              
                
      
              
              
                            if(config.init.GIT_ADD_SUBMODULE_BEHAVIOUR != null && config.init.GIT_ADD_SUBMODULE_BEHAVIOUR != ''){
              
              
                                if(config.init.GIT_ADD_SUBMODULE_BEHAVIOUR == 'true'){
              
              
                                    def scmTraits = scmNavigator.getTraits() as java.util.ArrayList
              
              
                                    scmTraits.add(
              
              
                                        new jenkins.plugins.git.traits.SubmoduleOptionTrait( // perform a submodule checkout within the normal scm checkout
              
              
                                            new hudson.plugins.git.extensions.impl.SubmoduleOption(
              
              
                                                false, true, false, '', 1, true
              
              
                                            )
              
              
                                        )
              
              
                                    );
              
              
                                    scmNavigator.setTraits(scmTraits);
              
              
                                }
              
              
                            }
              
              
                
      
              
              
                            job.getSCMNavigators().add(scmNavigator)
              
              
                
      
              
              
                            def pruneDeadBranches = true
              
              
                            def daysToKeep = 0
              
              
                            def numToKeep = 1
              
              
                            job.setOrphanedItemStrategy(new com.cloudbees.hudson.plugins.folder.computed.DefaultOrphanedItemStrategy(pruneDeadBranches, daysToKeep, numToKeep))
              
              
                            
              
              
                            def projectFactory = new org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProjectFactory()
              
              
                            projectFactory.scriptPath = config.init.JENKINSFILE_NAME ?: 'Jenkinsfile'
              
              
                            job.getProjectFactories().add(projectFactory)
              
              
                
      
              
              
                            job.buildStrategies.add(
              
              
                                new jenkins.branch.buildstrategies.basic.ChangeRequestBuildStrategyImpl(true) // ignore merge revision changes where the only difference is the target branch revision
              
              
                            )
              
              
                
      
              
              
                            // scan repository now
              
              
                            job.scheduleBuild2(0)
              
              
                
      
              
              
                            // configure automatic branch build behaviour
              
              
                            def automaticBranchBuilds = config.init.ENABLE_AUTOMATIC_BRANCH_BUILDS
              
              
                            logger.info("automatic branch builds: '${automaticBranchBuilds}'")
              
              
                            if (automaticBranchBuilds == null || automaticBranchBuilds.toString().trim() == 'false') {
              
              
                                logger.info("automatic branch builds are DISABLED")
              
              
                            } else if(automaticBranchBuilds.toString().trim() == 'true') {
              
              
                                logger.info("automatic branch builds ENABLED for ALL BRANCHES")
              
              
                                job.buildStrategies.add(new jenkins.branch.buildstrategies.basic.BranchBuildStrategyImpl())
              
              
                            } else {
              
              
                                logger.info("automatic branch builds ENABLED for branch pattern ${automaticBranchBuilds}")
              
              
                                job.buildStrategies.add(
              
              
                                    new jenkins.branch.buildstrategies.basic.NamedBranchBuildStrategyImpl([
              
              
                                            new jenkins.branch.buildstrategies.basic.NamedBranchBuildStrategyImpl.RegexNameFilter(
              
              
                                                automaticBranchBuilds,
              
              
                                                true
              
              
                                            )
              
              
                                        ]
              
              
                                    )
              
              
                                )
              
              
                            }

      Jenkins Version: 2.334
      github-branch-source-plugin Version: 2.11.4

      Hopefully someone can help us and thanks in advance

        1. image-2022-04-27-11-00-29-848.png
          49 kB
          Marc Fizia
        2. image-2022-04-27-11-00-49-118.png
          34 kB
          Marc Fizia
        3. image-2022-04-27-11-01-01-293.png
          26 kB
          Marc Fizia
        4. image-2022-04-27-13-39-31-615.png
          2 kB
          Marc Fizia

            Unassigned Unassigned
            mfizia Marc Fizia
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: