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

Git clone in pipeline ignoring reference repo

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Major Major
    • git-plugin
    • Jenkins 2.176.1
      Git Plugin 3.9.1

      On a freestyle project, everything works fine, but on a declarative pipeline I cannot make the reference repository to work

      Example of how we check out in the pipeline:

       

      checkout(
          [
              $class : 'GitSCM',
              branches : [[ name: "${branch}" ]],
              doGenerateSubmoduleConfigurations: false,
              extensions : [
                  [$class : 'RelativeTargetDirectory',
                   relativeTargetDir: targetDir
                  ],
                  [$class : 'CloneOption',
                   reference: '/somefolder/repo'
                  ]
              ],
              userRemoteConfigs : [[
                  url : ssh://blahblah/some.git,
                  credentialsId: ourCredentialsId
              ]]
          ]
      )
      

       

       

      and the output looks like this:

      [Pipeline] git
      Fetching changes from the remote Git repository
       > git rev-parse --is-inside-work-tree # timeout=10
       > git config remote.origin.url ssh://blahblah/some.git # timeout=10
      Fetching upstream changes from ssh://blahblah/some.git
       > git --version # timeout=10
      using GIT_SSH to set credentials Bitb-ssh-read
       > git fetch --tags --progress ssh://blahblah/some.git +refs/heads/*:refs/remotes/origin/*
      Checking out Revision 5eaf094e260b45a236792d8fd43f7d991bf9bbe0 (refs/remotes/origin/master)
       > git rev-parse refs/remotes/origin/master^{commit} # timeout=10
       > git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
       > git config core.sparsecheckout # timeout=10
       > git checkout -f 5eaf094e260b45a236792d8fd43f7d991bf9bbe0
      Commit message: "look mommy no hands"
      First time build. Skipping changelog.
      

      It is not even trying to use the reference, as there is no line like

      Using reference repository: /somefolder/repo
      

       

       

       

            Unassigned Unassigned
            vince82 Vincenzo Melandri
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: