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

Git Clone from Reference repo still fetching from remote repo

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Major Major
    • git-plugin

      I do believe I placed this in the right component, but it might be one for the scm plugin.

      I have tried to use git reference as I have used it in Jenkins jobs previously. It is in the API that it is supported but it still fetches from the external git server.

      node {
         // Mark the code checkout 'stage'....
         stage 'Checkout'
      
         // Get some code from a GitHub repository
         git url: 'ssh://git@server/project.git', reference: '/tmp/git.reference', branch: 'develop', credentialsId: '000000001-0001-001-abc1-000000000000001'
      }
      

      I have now also tried:

      checkout scm: [$class: 'GitSCM', branches: [[name: '*/develop']], userRemoteConfigs: [[url: 'ssh://git@server/project.git', reference: '/tmp/git.reference']]], credentialsId: '000000001-0001-001-abc1-000000000000001'
      

      And the generated script from the snippet generator:

      checkout([$class: 'GitSCM', branches: [[name: '*/develop']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'CloneOption', noTags: false, reference: '/tmp/git.reference', shallow: false]], submoduleCfg: [], userRemoteConfigs: [[credentialsId: '000000001-0001-001-abc1-000000000000001', url: 'ssh://git@server/project.git']]])
      

      This to me seems valid, however it will pull straight from the remote server and never pass the /tmp/git.reference, which I have used both for cloning manually on the server and for cloning using Jenkins default GUI for configuring builds. In Jenkins I used Advanced Cloning Behaviour, which I would assume this is trying to replicate.

      I should note: This reference folder only exists on slaves, not on the master.

      I could be using the API incorrectly

      Thanks for the support.

      /Marcus

            markewaite Mark Waite
            marcuss Marcus Sjölin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: