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

Allow Git shallow clone in Multibranch pipeline

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Duplicate
    • Icon: Major Major
    • pipeline

      Cloning full Git repository can take a long time (in my case over 10 minutes which results in timeout).

      In the freestyle project I can specify additional clone options like shallow clone. Unfortunatelny I cannot do this in Multibranch Pipeline project with Jenkinsfile.

      I've tried modifying scm.extensions using code like this:

      @NonCPS
      def checkout_src() {
        def copt = new CloneOption(true, "", 999)
      
        def r = scm.extensions.add(copt)
      
        echo "${scm.extensions}"
      
        checkout scm
      
        scm.extensions.remove(copt)
      }
      

      However when executed CloneOption is not added to extensions:

      Extensions: [hudson.plugins.git.extensions.impl.BuildChooserSetting@87d105]
      

      It would be nice if it was possible to add extensions to SCM via Jenkinsfile.

            jglick Jesse Glick
            novakov Maciej Nowak
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: