<p>It seems that it is only possible by using a workaround as depicted in <a href="https://stackoverflow.com/a/49637685/2777965">this answer</a>.</p>

<p>After setting gitLFS in the UI, subsequently inspecting the <code>/var/lib/jenkins/jobs/some-job/config.xml</code> file it became obvious that the XML looked as follows:</p>

<pre><code>&lt;traits&gt;
   &lt;jenkins.plugins.git.traits.GitLFSPullTrait&gt;
      &lt;extension class="hudson.plugins.git.extensions.impl.GitLFSPull"/&gt;
   &lt;/jenkins.plugins.git.traits.GitLFSPullTrait&gt;
&lt;/traits
</code></pre>

<p>After defining <code>jenkins.plugins.git.traits.GitLFSPullTrait</code>:</p>

<pre><code>jobs:
  - script: &gt;
      multibranchPipelineJob("example") {
        branchSources {
          ...
        }
        configure { node -&gt;
          node / sources / data / 'jenkins.branch.BranchSource' / source / traits {
            'jenkins.plugins.git.traits.GitLFSPullTrait'()
          }
        }
      }
</code></pre>

<p>Git-lfs was enabled.</p>

CC BY-SA 4.0
2019-09-23T16:47:17.897Z
2019-09-23T16:47:17.897Z
030
<p>We are using the Jenkins Configuration As Code (JCAC) plugin to automate the jenkins configuration. One of the challenges is to set <code>git-lfs</code> as an additional checkout behavior.</p>

<p><code>GitLFSPull</code> has to be configured, but it does not seem to be included in the <a href="https://jenkinsci.github.io/job-dsl-plugin/#path/multibranchPipelineJob" rel="nofollow noreferrer">DSL</a>:</p>

<p><a href="https://i.sstatic.net/0R118.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/0R118.png" alt="enter image description here"></a></p>

<p>The README of the JCAC github repository indicates that support questions should be asked on <a href="https://gitter.im/jenkinsci/configuration-as-code-plugin?at=5d87457c5ab9361694381b5d" rel="nofollow noreferrer">Gitter</a></p>

<p>According to <a href="https://stackoverflow.com/a/44961242/2777965">this Q&amp;A</a>, <code>GitLFSPull</code> should be an extension:</p>

<pre><code>extensions: [[$class: 'GitLFSPull']]
</code></pre>

<p>However, querying for this on <a href="https://jenkinsci.github.io/job-dsl-plugin/#path/job-scm-git-extensions" rel="nofollow noreferrer">the Job DSL page</a> shows that GitLFSPull seems to be omitted:</p>

<p><a href="https://i.sstatic.net/dw2gr.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/dw2gr.png" alt="enter image description here"></a></p>

<jenkins><jcac>
How to set git-lfs as an additional checkout behavior using the JCAC plugin?
030
# How to set git-lfs as an additional checkout behavior using the JCAC plugin?

(Asked by: username_0 on 2019-09-20)

We are using the Jenkins Configuration As Code (JCAC) plugin to automate the jenkins configuration. One of the challenges is to set git-lfs as an additional checkout behavior.
GitLFSPull has to be configured, but it does not seem to be included in the DSL:

The README of the JCAC github repository indicates that support questions should be asked on Gitter
According to this Q&A, GitLFSPull should be an extension:
extensions: [[$class: 'GitLFSPull']]

However, querying for this on the Job DSL page shows that GitLFSPull seems to be omitted:

**Tags:** jenkins, jcac


---

## 1 answers

### Answer by username_0 on 2019-09-23. Score: 1 | Accepted answer

It seems that it is only possible by using a workaround as depicted in this answer.
After setting gitLFS in the UI, subsequently inspecting the /var/lib/jenkins/jobs/some-job/config.xml file it became obvious that the XML looked as follows:

   
      
   

After defining jenkins.plugins.git.traits.GitLFSPullTrait:
jobs:
  - script: >
      multibranchPipelineJob("example") {
        branchSources {
          ...
        }
        configure { node ->
          node / sources / data / 'jenkins.branch.BranchSource' / source / traits {
            'jenkins.plugins.git.traits.GitLFSPullTrait'()
          }
        }
      }

Git-lfs was enabled.


---

