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

GitLFS is not working on Jenkins pipeline

XMLWordPrintable

      SCM Checkout step doesn't work with GITLFS both via SSH and HTTPS method using Jenkinsfile. Here is my function : 

       

      def checkoutStep(branchname, repo, targetdir = "") {

      {{ checkout changelog: false, poll: false,
      scm: [$class : 'GitSCM',
      branches : [[name: "${branchname}"]],
      browser : [$class: 'GithubWeb', repoUrl: "XXXXXXXX"],
      doGenerateSubmoduleConfigurations: false,
      extensions : [[$class: 'CleanCheckout'],
      [$class: 'CleanBeforeCheckout'],
      [$class: 'RelativeTargetDirectory', relativeTargetDir: "${targetdir}"],
      [$class: 'CloneOption', depth: 0, noTags: true, reference: '', shallow: false],
      [$class: 'GitLFSPull']],
      submoduleCfg : [],
      userRemoteConfigs : [[credentialsId: 'XXXXXXXXX', url: "git@github.com:XXXXXXX"]]]}}

      }

      It fails with below error.

      Checking out git https://github.com/XXXXXXX into /var/jenkins_home/jobs/in-ci-pipeline-dev/workspace@script to read Jenkinsfile using credential XXXXXXXXXX

       

      {{git rev-parse --is-inside-work-tree # timeout=10
      Fetching changes from the remote Git repository
      git config remote.origin.url https://github.com/XXXXXXX# timeout=10
      Fetching upstream changes from https://github.com/XXXXXXX
      git --version # timeout=10
      using GIT_ASKPASS to set credentials XXXXXXXX credentials for the web
      git fetch --tags --progress – https://github.com/XXXXXXXX +refs/heads/:refs/remotes/origin/
      git rev-parse dev/in-ci-jenkinsfile^{commit} # timeout=10
      git rev-parse refs/remotes/origin/dev/in-ci-jenkinsfile^{commit} # timeout=10
      Checking out Revision ffc2f625856285fe418ee344c46291fbb6c03b35 (refs/remotes/origin/dev/in-
      ci-jenkinsfile)
      git config core.sparsecheckout # timeout=10
      git checkout -f ffc2f625856285fe418ee344c46291fbb6c03b35
      ERROR: Checkout failed
      hudson.plugins.git.GitException: Command "git checkout -f
      ffc2f625856285fe418ee344c46291fbb6c03b35" returned status code 128:
      stdout:
      stderr: Downloading app-new/config/browscap.ini (88 MB)
      Error downloading object: app-new/config/browscap.ini (ba81f69): Smudge error: Error downloading app-new/config/browscap.ini (ba81f6956fa350f2837ec9d3b61842719e8b984dbec3fd54140b66df0cf7e13d): batch response: Bad credentials}}

      From the stderr output: You can see here that it has already got inside the repo, and when it is trying to pull the file which is of 88 MB using gitlfs, it throws error.

      Via: HTTPS it throws Bad Credential error Via: SSH it throws repo not found error.

      And the most strange thing is that, this only happens when I'm using the Jenkinsfile in a pipeline, but when I use it a scripted method, it works completely fine.

            whitewolf123 Gourav Pattnaik
            whitewolf123 Gourav Pattnaik
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: