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

Refusing to merge unrelated histories in a multibranch pipeline

XMLWordPrintable

      We have a multibranch pipeline job which is configured to discover pull requests from a github repository.

      The strategy is set to: Merging the pull request with the current target branch revision.

      We have another job which builds our project whenever a pull request is merged on github. That job will also increment the version number of the application, commit it on the develop branch, push on github, and will use curl to trigger a repository scan of the multibranch pipeline (using the Multibranch Scan Webhook Trigger plugin)

      The idea being to trigger another automatic validation on the pending pull requests when develop is changed.

      Everything goes fine, except that for we have errors with the following log, when jenkins tries to merge the new origin/develop into the PR HEAD revision:

      Also:   hudson.remoting.Channel$CallSiteStackTrace: Remote call to JNLP4-connect connection from BUILDER6-TR.internal.fishingcactus.com/192.168.1.65:57248
      		at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1795)
      		at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:356)
      		at hudson.remoting.Channel.call(Channel.java:1001)
      		at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.execute(RemoteGitImpl.java:145)
      		at jdk.internal.reflect.GeneratedMethodAccessor386.invoke(Unknown Source)
      		at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      		at java.base/java.lang.reflect.Method.invoke(Unknown Source)
      		at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.invoke(RemoteGitImpl.java:131)
      		at com.sun.proxy.$Proxy98.execute(Unknown Source)
      		at jenkins.plugins.git.MergeWithGitSCMExtension.decorateRevisionToBuild(MergeWithGitSCMExtension.java:121)
      		at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:1167)
      		at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1306)
      		at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:129)
      		at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:97)
      		at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:84)
      		at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
      		at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
      		at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
      		at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      		at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      		at java.base/java.lang.Thread.run(Unknown Source)
      hudson.plugins.git.GitException: Command "git merge a3688ef49613d8f3b8ff31eba0eae6aa56700c99" returned status code 128:
      stdout: 
      stderr: fatal: refusing to merge unrelated histories	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2681)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2102)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2002)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1993)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$600(CliGitAPIImpl.java:86)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$3.execute(CliGitAPIImpl.java:961)
      	at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$GitCommandMasterToSlaveCallable.call(RemoteGitImpl.java:160)
      	at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$GitCommandMasterToSlaveCallable.call(RemoteGitImpl.java:153)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:211)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:54)
      	at hudson.remoting.Request$2.run(Request.java:376)
      	at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78)
      	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
      	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      	at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:122)
      	at java.base/java.lang.Thread.run(Thread.java:829)GitHub has been notified of this commit's build result
      

      I'd like to mention that we read somewhere that it could be an issue with shallow clones, but our multibranch pipeline is not configured to do shallow clones.

      I hope I provided enough context and informations, otherwise feel free to tell me and I'll gladly add more.

            igalg Igal Gluh
            emidee Michael
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: