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

Allow refspec with Bitbucket Server Plugin (BbS)

XMLWordPrintable

      I recently had to switch from using GitSCM to BbS in the checkout commands in my multibranch pipeline script.

      My GitSCM checkout looked like this:

       

      checkout(
        scm:
          [$class: 'GitSCM',
            branches: [[name: env.BRANCH_NAME]],
            userRemoteConfigs: [
              [credentialsId: '<REDACTED>',
                refspec: "+refs/heads/${env.BRANCH_NAME}:refs/remotes/origin/${env.BRANCH_NAME}",
                url: '<REDACTED>']
            ],
            extensions: [
              [$class: 'RelativeTargetDirectory', relativeTargetDir: '<REDACTED>'],
              [$class: 'CloneOption',
                depth: 1,
                honorRefspec: true,
                noTags: true,
                reference: '<REDACTED>',
                shallow: true],
              [$class: 'SparseCheckoutPaths',
                sparseCheckoutPaths: sparseCheckoutPaths]
            ]])

       

       

      And my BbS checkout looks like this:

      checkout(
        BbS(
          id: '<REDACTED>',
          serverId: '<REDACTED>',
          credentialsId: '<REDACTED>',
          projectName: '<REDACTED>',
          repositoryName: '<REDACTED>',
          branches: [[name: env.BRANCH_NAME]],
          extensions: [
            [$class: 'RelativeTargetDirectory', relativeTargetDir: '<REDACTED>'],
            [$class: 'CloneOption',
              depth: 1,
              noTags: true,
              reference: '<REDACTED>',
              shallow: true],
            [$class: 'SparseCheckoutPaths',
              sparseCheckoutPaths: sparseCheckoutPaths]])) 

      The BbS checkout is much slower than the GitSCM one, 1.5 min versus 9 sec, respectively. I believe this is because of the missing refspec in the BbS checkout. Tests with git on the command line have shown this to be true. Using a refspec greatly improves the checkout time.

      Can support for refspecs be added to BbS? Am I missing how to do this with the existing functionality?

            Unassigned Unassigned
            wright_left Aaron Wright
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: