-
Bug
-
Resolution: Duplicate
-
Minor
-
None
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
- is related to
-
JENKINS-47389 sh step within container step does not work when user is non-root
-
- Resolved
-
-
JENKINS-30600 git isn't run inside build container
-
- Open
-
-
JENKINS-46055 "dir" fails to use existing directory owned by root
-
- Open
-
[JENKINS-46230] git-lfs not working in kubernetes container
Assignee | Original: Mark Waite [ markewaite ] |
Component/s | Original: git-plugin [ 15543 ] | |
Component/s | Original: kubernetes-plugin [ 20639 ] |
I don't understand which work around you believe would resolve your issue in your kubernetes container.
That issue on GitHub seems to mention credential helpers, even though Linux machines (and kubernetes pods) rarely use credentials helpers. Your pod does not seem to be defining a credentials helper, so I assume it is not a credential helper issue.
That issue also mentions case insensitive file name extensions, yet you said that the clone works when you perform a git clone from inside the kubernetes pod. I would expect case insensitive file name extensions to cause that to break no matter what you did, since the typical Linux file system is case sensitive.
The message from the checkout step hints (to me) that the lfs command was not installed in a portion of the PATH defined for the checkout step. That is quite odd, since I assume the preceding git lfs install is not reporting any errors. Can you confirm that git lfs install reports that git lfs is installed?
Can you perform the git init; git remote add origin your_url; git fetch origin; git lfs fetch origin origin/master command from a shell step immediately prior to your checkout step?
What is the output of git --version on your kubernetes instances? Is the git new enough to support LFS?