Background: I am using Git LFS with the repo, and we need to do a Git LFS pull in the checkout logic while using Jenkins's groovy functions for the Pipeline. What this does is replaces the pointers with the actual files which are later on used during the CI compute phase.
Problem: GitLFSPull SCM plugin exists and works without error when used as a scmExtension but it is not giving the expected results, basically the plugin activates, states the below, but I suspect the git lfs pull origin is not working
Enabling Git LFS pull
> git rev-parse refs/remotes/origin/feature/xyz^{commit} # timeout=10
> git rev-parse refs/remotes/origin/origin/feature/xyz^{commit} # timeout=10
> git config core.sparsecheckout # timeout=10
> git checkout -f hash # timeout=10
> git config --get remote.origin.url # timeout=10
> git lfs pull origin # timeout=10
I would like to understand, am I missing something to use the Jenkins plugin correctly ? The below is the Checkout function that we are using
def checkoutSourceCode(checkoutDir) {
dir(checkoutDir) {
checkout changelog: true,
poll: true,
scm: [$class: 'GitSCM',
branches: [[name: "origin/" + params.SOURCE_BRANCH]],
doGenerateSubmoduleConfigurations: false,
extensions : [
[$class: 'CloneOption', noTags: true, reference: '', shallow: false],
[$class: 'CleanBeforeCheckout'],
[$class: 'PruneStaleBranch'],
[$class: 'AuthorInChangelog'],
[$class: 'GitLFSPull']
[$class: 'UserIdentity', email: '[email protected]', name: 'xyzzy'],
[$class: 'SubmoduleOption',
disableSubmodules : false,
parentCredentials : true,
recursiveSubmodules: true,
reference : '',
trackingSubmodules : false]],
submoduleCfg : [],
userRemoteConfigs : [[name : 'origin',
credentialsId: 'xyzzy',
url : 'ssh://xyz.xyn.com/something.git']]]
gitCommit = sh(returnStdout: true, script: 'git rev-parse HEAD').trim()
shortCommit = gitCommit.take(6)
return shortCommit
}
}
So this is how this issue was solved. For my sake and tracking sake.
brew install git-lfs($whereis git-lfs)with that of the systemusr\bin\<>so that themastersystem where the CI runs knows where LFS is, the master system was not finding where LFS is.git lfs statusas a CLI command to make sure LFS is there, in the groovy script usingsh