Git LFS setup in jenkins

Viewed 27126

I have an issue with git LFS use in Jenkins. What I am doing now is that

  1. I am building a war from maven through Jenkins that war contains a jar file
  2. through Git LFS we have converted that jar file into a pointer file. But during checkout from Jenkins that jar is not converting into its original size rather it is included in the war as a pointer.

We have used git plugin and git-client plugin with version 3.3.0 and 2.4.2 respectively in Jenkins.

What is happening:

A.war -> a.jar(whose original size is 1234 kb but it's coming 3 kb (which is the size of pointer file)

so my questions are:

  1. how to use git LFS in the Jenkins?
  2. is there any separate Git Lfs plugin for Jenkins?
  3. How should the file convert to its original size during checkout when one use Git LfS?
2 Answers

This can be done with "Pre SCM BuildStep” Plugin.

  1. Add “Pre SCM BuildStep” Plugin in Jenkins.

  2. In Job Configuration

    1. Select the property Run buildstep before SCM runs in Build Environment Section

    2. Click on Add Build Step

    3. Select Execute Shell or Execute Windows batch command.

    4. Add the following command in the shell,

      git lfs install

  3. In the Source Code Management section -> Additional Behaviours -> Add Git LFS pull after checkout.

Reference Link

Related