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

git-lfs not working in kubernetes container

    XMLWordPrintable

Details

    Description

      Trying to make use of the git-lfs addition to the checkout step, but it's failing.

      The error I'm getting is:

      Fetching without tags
      Fetching upstream changes from https://github.com/---
      using GIT_ASKPASS to set credentials 
       > git fetch --tags --progress https://github.com/--- +refs/heads/master:refs/remotes/origin/master --depth=2
      Checking out Revision 33d759e (master)
      Commit message: "---"
       > git config core.sparsecheckout # timeout=10
       > git checkout -f 33d759e
      
      hudson.plugins.git.GitException: Command "git checkout -f 33d759e" returned status code 128:
      stdout: 
      stderr: git-lfs filter-process: line 1: git-lfs: not found
      fatal: The remote end hung up unexpectedly
      

      The example pipeline code that is failing: 

      podTemplate(label: "test", containers: [
          containerTemplate(name: "golang", image: "golang:1.8", ttyEnabled: true, command: "cat"
          )
      ]) {
      	node("test") {
      		container(name: "golang") {
      			stage("checkout") {
      				// install git lfs on debian based pod
      				sh "curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash"
      				sh "apt-get install git-lfs"
      				sh "git lfs install"
      				checkout([
      					$class: "GitSCM",
      					branches: scm.branches,
      					extensions: scm.extensions + [
      						[$class: "CloneOption", depth: 2, shallow: true],
      						[$class: "GitLFSPull"]
      					],
      					userRemoteConfigs: scm.userRemoteConfigs
      				])
      				sh 'ls -l'
      			}
      		}
      	}
      }
       

      If I log into the pod after git-lfs is installed and run `git clone` directly, it works and pulls the large file. My guess is that this problem is related to this bug/workaround, but I don't know how to implement this in the k8s/jenkins env
      https://github.com/git-lfs/git-lfs/issues/1821#issuecomment-272889540

      Attachments

        Issue Links

          Activity

            jknurek J Knurek created issue -
            markewaite Mark Waite made changes -
            Field Original Value New Value
            Assignee Mark Waite [ markewaite ]
            markewaite Mark Waite made changes -
            Component/s git-plugin [ 15543 ]
            Component/s kubernetes-plugin [ 20639 ]
            jknurek J Knurek made changes -
            Component/s kubernetes-plugin [ 20639 ]
            jknurek J Knurek made changes -
            Link This issue is related to JENKINS-47389 [ JENKINS-47389 ]
            jknurek J Knurek made changes -
            Link This issue is related to JENKINS-46055 [ JENKINS-46055 ]
            markewaite Mark Waite made changes -
            Link This issue is related to JENKINS-30600 [ JENKINS-30600 ]
            markewaite Mark Waite made changes -
            Resolution Duplicate [ 3 ]
            Status Open [ 1 ] Closed [ 6 ]

            People

              Unassigned Unassigned
              jknurek J Knurek
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: