Answers: <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>
  
Answers: CC BY-SA 4.0
Answers: 2019-09-23T16:47:17.897Z
Answers: 2019-09-23T16:47:17.897Z
Answers: 030
Body: <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>
  
Tags: <jenkins><jcac>
Title: How to set git-lfs as an additional checkout behavior using the JCAC plugin?
UserDisplayName: 030
ThreadText: # 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](https://jenkinsci.github.io/job-dsl-plugin/#path/multibranchPipelineJob):
  
  [![enter image description here](https://i.sstatic.net/0R118.png)](https://i.sstatic.net/0R118.png)
  
  The README of the JCAC github repository indicates that support questions should be asked on [Gitter](https://gitter.im/jenkinsci/configuration-as-code-plugin?at=5d87457c5ab9361694381b5d)
  
  According to [this Q&A](https://stackoverflow.com/a/44961242/2777965), `GitLFSPull` should be an extension:
  
  ```
  extensions: [[$class: 'GitLFSPull']]
  
  ```
  
  However, querying for this on [the Job DSL page](https://jenkinsci.github.io/job-dsl-plugin/#path/job-scm-git-extensions) shows that GitLFSPull seems to be omitted:
  
  [![enter image description here](https://i.sstatic.net/dw2gr.png)](https://i.sstatic.net/dw2gr.png)
  
  **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](https://stackoverflow.com/a/49637685/2777965).
  
  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:
  
  ```
  <traits>
     <jenkins.plugins.git.traits.GitLFSPullTrait>
        <extension class="hudson.plugins.git.extensions.impl.GitLFSPull"/>
     </jenkins.plugins.git.traits.GitLFSPullTrait>
  </traits
  
  ```
  
  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.
  
  
  ---
  
  