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

Setting CloneOption trait on SCMSource with shallow depth causes MR builds to fail

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Steps to reproduce:

      On multibranch pipeline job, configure GitlabSCMSource with a clone option trait that has the shallow flag turned on.

      CloneOption cloneOption = new CloneOption(true, true, "", 30);
      

      Trigger a build of a merge request. 

       

      Expected result:

      Merge request should succeed.

       

      Actual result:

      Merge requests fails with error: 

      stderr: fatal: refusing to merge unrelated histories

      I believe this problem could be resolved by using

      MergeWithGitSCMExtension

      from the git-plugin class. The github-branch-source-plugin and the bitbucket-branch-source-plugin have both deprecated their instances of this class in order to use the one in the Git plugin. See https://github.com/jenkinsci/git-plugin/blob/5b3300dfb225927551b8b9b86efed7aa74100884/src/main/java/jenkins/plugins/git/MergeWithGitSCMExtension.java#L88

      For now, our workaround is to set the shallow flag to false, which impacts all builds with Gitlab. We'd like to only set shallow to false when building MRs.

        Attachments

          Activity

          Show
          baymac Parichay Barpanda added a comment - Fixed in  https://github.com/jenkinsci/gitlab-branch-source-plugin/pull/81

            People

            Assignee:
            baymac Parichay Barpanda
            Reporter:
            timothy_bell Timothy Bell
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: