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

Bitbucket Server Integration fails cloning submodule using relative path

      We usually use relative paths in our .gitmodules files to ensure that we'll be able to clone the submodules from a forked project or different Bitbucket instance correctly.

      This is working totally fine when using the plain bitbucket plugin or when using the Bitbucket Branch Source plugin.

      However with the Bitbucket Server Integration plugin we get the following error - assuming the submodule is given as

      [submodule "foo"]
      	path = foo
      	url = ../foo-path
      

      and the enclosing repo would be called bar-enclosing

      in .gitmodules

      19:45:38   > git reset --hard # timeout=10
      19:45:38   > git clean -ffdx # timeout=10
      19:45:38   > git submodule foreach --recursive git reset --hard # timeout=10
      19:45:38   > git submodule foreach git clean -fdx # timeout=10
      19:45:38   > git remote # timeout=10
      19:45:38   > git submodule init # timeout=10
      19:45:38   > git submodule sync # timeout=10
      19:45:38   > git config --get remote.bar-enclosing.url # timeout=10
      19:45:38   > git submodule init # timeout=10
      19:45:38   > git config -f .gitmodules --get-regexp ^submodule\.(.+)\.url # timeout=10
      19:45:38   > git config --get submodule.foo.url # timeout=10
      19:45:38   > git config -f .gitmodules --get submodule.mock.path # timeout=10
      19:45:38   > git submodule update foo # timeout=10
      19:45:38  ERROR: Checkout failed
      19:45:38  hudson.plugins.git.GitException: Command "git submodule update mock" returned status code 128:
      19:45:38  stdout: 
      19:45:38  stderr: fatal: repository '/path/to/workspace/foo-path' does not exist
      19:45:38  fatal: clone of '/path/to/workspace/foo-path' into submodule path 'foo' failed
      19:45:38  
      19:45:38  	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2450)
      19:45:38  	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2051)
      19:45:38  	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:84)
      19:45:38  	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$7.lambda$execute$0(CliGitAPIImpl.java:1460)
      19:45:38  	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      19:45:38  	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      19:45:38  	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      19:45:38  	at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:253)
      19:45:38  	at java.util.concurrent.ExecutorCompletionService.submit(ExecutorCompletionService.java:181)
      19:45:38  	at org.jenkinsci.plugins.gitclient.cgit.GitCommandsExecutor.submitRemainingCommand(GitCommandsExecutor.java:75)
      19:45:38  	at org.jenkinsci.plugins.gitclient.cgit.GitCommandsExecutor.invokeAll(GitCommandsExecutor.java:64)
      19:45:38  Caused: hudson.plugins.git.GitException
      19:45:38  	at org.jenkinsci.plugins.gitclient.cgit.GitCommandsExecutor.checkResult(GitCommandsExecutor.java:87)
      19:45:38  	at org.jenkinsci.plugins.gitclient.cgit.GitCommandsExecutor.invokeAll(GitCommandsExecutor.java:68)
      19:45:38  	at org.jenkinsci.plugins.gitclient.cgit.GitCommandsExecutor.invokeAll(GitCommandsExecutor.java:47)
      19:45:38  	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$7.execute(CliGitAPIImpl.java:1463)
      19:45:38  	at hudson.plugins.git.extensions.impl.SubmoduleOption.onCheckoutCompleted(SubmoduleOption.java:161)
      19:45:38  Caused: java.io.IOException: Could not perform submodule update
      19:45:38  	at hudson.plugins.git.extensions.impl.SubmoduleOption.onCheckoutCompleted(SubmoduleOption.java:166)
      19:45:38  	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1379)
      19:45:38  	at com.atlassian.bitbucket.jenkins.internal.scm.BitbucketSCM.checkout(BitbucketSCM.java:206)
      19:45:38  	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:125)
      19:45:38  	at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:155)
      19:45:38  	at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:69)
      19:45:38  	at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:299)
      19:45:38  	at hudson.model.ResourceController.execute(ResourceController.java:97)
      19:45:38  	at hudson.model.Executor.run(Executor.java:428)
      19:45:38  ERROR: Maximum checkout retry attempts reached, aborting
      19:45:38  Finished: FAILURE
      

      Esp. the following lines suggest that the handling of the relative path is not implemented correctly in the Bitbucket Server Integration plugin:

      19:45:38  stderr: fatal: repository '/path/to/workspace/foo-path' does not exist
      19:45:38  fatal: clone of '/path/to/workspace/foo-path' into submodule path 'foo' failed
      

      About the job:
      I was using a standard Pipeline job, taking the Jenkinsfile from SCM. In the SCM configuration I configured the plugin to clone submodules like:

          [JENKINS-64748] Bitbucket Server Integration fails cloning submodule using relative path

          Joerg Schwaerzler created issue -
          Joerg Schwaerzler made changes -
          Attachment New: screenshot-1.png [ 53906 ]
          Joerg Schwaerzler made changes -
          Description Original: We usually use relative paths in our {{.gitmodules}} files to ensure that we'll be able to clone the submodules from a forked project or different Bitbucket instance correctly.

          This is working totally fine when using the plain bitbucket plugin or when using the Bitbucket Branch Source plugin.

          However with the Bitbucket Server Integration plugin we get the following error - assuming the submodule is given as
          {code}
          [submodule "foo"]
          path = foo
          url = ../foo-path
          {code}

          and the enclosing repo would be called {{bar-enclosing}}

          in {{.gitmodules}}

          {code}
          19:45:38 > git reset --hard # timeout=10
          19:45:38 > git clean -ffdx # timeout=10
          19:45:38 > git submodule foreach --recursive git reset --hard # timeout=10
          19:45:38 > git submodule foreach git clean -fdx # timeout=10
          19:45:38 > git remote # timeout=10
          19:45:38 > git submodule init # timeout=10
          19:45:38 > git submodule sync # timeout=10
          19:45:38 > git config --get remote.bar-enclosing.url # timeout=10
          19:45:38 > git submodule init # timeout=10
          19:45:38 > git config -f .gitmodules --get-regexp ^submodule\.(.+)\.url # timeout=10
          19:45:38 > git config --get submodule.foo.url # timeout=10
          19:45:38 > git config -f .gitmodules --get submodule.mock.path # timeout=10
          19:45:38 > git submodule update foo # timeout=10
          19:45:38 ERROR: Checkout failed
          19:45:38 hudson.plugins.git.GitException: Command "git submodule update mock" returned status code 128:
          19:45:38 stdout:
          19:45:38 stderr: fatal: repository '/path/to/workspace/foo-path' does not exist
          19:45:38 fatal: clone of '/path/to/workspace/foo-path' into submodule path 'foo' failed
          19:45:38
          19:45:38 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2450)
          19:45:38 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2051)
          19:45:38 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:84)
          19:45:38 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$7.lambda$execute$0(CliGitAPIImpl.java:1460)
          19:45:38 at java.util.concurrent.FutureTask.run(FutureTask.java:266)
          19:45:38 at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
          19:45:38 at java.util.concurrent.FutureTask.run(FutureTask.java:266)
          19:45:38 at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:253)
          19:45:38 at java.util.concurrent.ExecutorCompletionService.submit(ExecutorCompletionService.java:181)
          19:45:38 at org.jenkinsci.plugins.gitclient.cgit.GitCommandsExecutor.submitRemainingCommand(GitCommandsExecutor.java:75)
          19:45:38 at org.jenkinsci.plugins.gitclient.cgit.GitCommandsExecutor.invokeAll(GitCommandsExecutor.java:64)
          19:45:38 Caused: hudson.plugins.git.GitException
          19:45:38 at org.jenkinsci.plugins.gitclient.cgit.GitCommandsExecutor.checkResult(GitCommandsExecutor.java:87)
          19:45:38 at org.jenkinsci.plugins.gitclient.cgit.GitCommandsExecutor.invokeAll(GitCommandsExecutor.java:68)
          19:45:38 at org.jenkinsci.plugins.gitclient.cgit.GitCommandsExecutor.invokeAll(GitCommandsExecutor.java:47)
          19:45:38 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$7.execute(CliGitAPIImpl.java:1463)
          19:45:38 at hudson.plugins.git.extensions.impl.SubmoduleOption.onCheckoutCompleted(SubmoduleOption.java:161)
          19:45:38 Caused: java.io.IOException: Could not perform submodule update
          19:45:38 at hudson.plugins.git.extensions.impl.SubmoduleOption.onCheckoutCompleted(SubmoduleOption.java:166)
          19:45:38 at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1379)
          19:45:38 at com.atlassian.bitbucket.jenkins.internal.scm.BitbucketSCM.checkout(BitbucketSCM.java:206)
          19:45:38 at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:125)
          19:45:38 at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:155)
          19:45:38 at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:69)
          19:45:38 at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:299)
          19:45:38 at hudson.model.ResourceController.execute(ResourceController.java:97)
          19:45:38 at hudson.model.Executor.run(Executor.java:428)
          19:45:38 ERROR: Maximum checkout retry attempts reached, aborting
          19:45:38 Finished: FAILURE
          {code}

          Esp. the following lines suggest that the handling of the relative path is not implemented correctly in the Bitbucket Server Integration plugin:
          {code}
          19:45:38 stderr: fatal: repository '/path/to/workspace/foo-path' does not exist
          19:45:38 fatal: clone of '/path/to/workspace/foo-path' into submodule path 'foo' failed
          {code}
          New: We usually use relative paths in our {{.gitmodules}} files to ensure that we'll be able to clone the submodules from a forked project or different Bitbucket instance correctly.

          This is working totally fine when using the plain bitbucket plugin or when using the Bitbucket Branch Source plugin.

          However with the Bitbucket Server Integration plugin we get the following error - assuming the submodule is given as
          {code}
          [submodule "foo"]
          path = foo
          url = ../foo-path
          {code}

          and the enclosing repo would be called {{bar-enclosing}}

          in {{.gitmodules}}

          {code}
          19:45:38 > git reset --hard # timeout=10
          19:45:38 > git clean -ffdx # timeout=10
          19:45:38 > git submodule foreach --recursive git reset --hard # timeout=10
          19:45:38 > git submodule foreach git clean -fdx # timeout=10
          19:45:38 > git remote # timeout=10
          19:45:38 > git submodule init # timeout=10
          19:45:38 > git submodule sync # timeout=10
          19:45:38 > git config --get remote.bar-enclosing.url # timeout=10
          19:45:38 > git submodule init # timeout=10
          19:45:38 > git config -f .gitmodules --get-regexp ^submodule\.(.+)\.url # timeout=10
          19:45:38 > git config --get submodule.foo.url # timeout=10
          19:45:38 > git config -f .gitmodules --get submodule.mock.path # timeout=10
          19:45:38 > git submodule update foo # timeout=10
          19:45:38 ERROR: Checkout failed
          19:45:38 hudson.plugins.git.GitException: Command "git submodule update mock" returned status code 128:
          19:45:38 stdout:
          19:45:38 stderr: fatal: repository '/path/to/workspace/foo-path' does not exist
          19:45:38 fatal: clone of '/path/to/workspace/foo-path' into submodule path 'foo' failed
          19:45:38
          19:45:38 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2450)
          19:45:38 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2051)
          19:45:38 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:84)
          19:45:38 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$7.lambda$execute$0(CliGitAPIImpl.java:1460)
          19:45:38 at java.util.concurrent.FutureTask.run(FutureTask.java:266)
          19:45:38 at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
          19:45:38 at java.util.concurrent.FutureTask.run(FutureTask.java:266)
          19:45:38 at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:253)
          19:45:38 at java.util.concurrent.ExecutorCompletionService.submit(ExecutorCompletionService.java:181)
          19:45:38 at org.jenkinsci.plugins.gitclient.cgit.GitCommandsExecutor.submitRemainingCommand(GitCommandsExecutor.java:75)
          19:45:38 at org.jenkinsci.plugins.gitclient.cgit.GitCommandsExecutor.invokeAll(GitCommandsExecutor.java:64)
          19:45:38 Caused: hudson.plugins.git.GitException
          19:45:38 at org.jenkinsci.plugins.gitclient.cgit.GitCommandsExecutor.checkResult(GitCommandsExecutor.java:87)
          19:45:38 at org.jenkinsci.plugins.gitclient.cgit.GitCommandsExecutor.invokeAll(GitCommandsExecutor.java:68)
          19:45:38 at org.jenkinsci.plugins.gitclient.cgit.GitCommandsExecutor.invokeAll(GitCommandsExecutor.java:47)
          19:45:38 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$7.execute(CliGitAPIImpl.java:1463)
          19:45:38 at hudson.plugins.git.extensions.impl.SubmoduleOption.onCheckoutCompleted(SubmoduleOption.java:161)
          19:45:38 Caused: java.io.IOException: Could not perform submodule update
          19:45:38 at hudson.plugins.git.extensions.impl.SubmoduleOption.onCheckoutCompleted(SubmoduleOption.java:166)
          19:45:38 at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1379)
          19:45:38 at com.atlassian.bitbucket.jenkins.internal.scm.BitbucketSCM.checkout(BitbucketSCM.java:206)
          19:45:38 at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:125)
          19:45:38 at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:155)
          19:45:38 at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:69)
          19:45:38 at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:299)
          19:45:38 at hudson.model.ResourceController.execute(ResourceController.java:97)
          19:45:38 at hudson.model.Executor.run(Executor.java:428)
          19:45:38 ERROR: Maximum checkout retry attempts reached, aborting
          19:45:38 Finished: FAILURE
          {code}

          Esp. the following lines suggest that the handling of the relative path is not implemented correctly in the Bitbucket Server Integration plugin:
          {code}
          19:45:38 stderr: fatal: repository '/path/to/workspace/foo-path' does not exist
          19:45:38 fatal: clone of '/path/to/workspace/foo-path' into submodule path 'foo' failed
          {code}

          About the job:
          I was using a standard Pipeline job, taking the Jenkinsfile from SCM. In the SCM configuration I configured the plugin to clone submodules like:

           !screenshot-1.png|thumbnail!
          Joerg Schwaerzler made changes -
          Priority Original: Minor [ 4 ] New: Major [ 3 ]
          Martin Henschke made changes -
          Assignee Original: Kristy Hughes [ khughes ]
          Naj made changes -
          Labels New: triaged

            Unassigned Unassigned
            macdrega Joerg Schwaerzler
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: