How can I define git sparse checkouts?

929 views
Skip to first unread message

Christian Goetze

unread,
Sep 20, 2014, 5:38:12 PM9/20/14
to job-dsl...@googlegroups.com
It appears I would need to use a configure block..

How do I translate this XML part into a configure block to get git sparse checkouts?

<extensions>
  <hudson.plugins.git.extensions.impl.CloneOption>
    <shallow>false</shallow>
    <reference>/build/jenkins/codebase.git</reference>
  </hudson.plugins.git.extensions.impl.CloneOption>
  <hudson.plugins.git.extensions.impl.SparseCheckoutPaths>
    <sparseCheckoutPaths>
      <hudson.plugins.git.extensions.impl.SparseCheckoutPath>
        <path>BillOfMaterials.yml</path>
      </hudson.plugins.git.extensions.impl.SparseCheckoutPath>
      <hudson.plugins.git.extensions.impl.SparseCheckoutPath>
        <path>jenkins/job/</path>
      </hudson.plugins.git.extensions.impl.SparseCheckoutPath>
    </sparseCheckoutPaths>
  </hudson.plugins.git.extensions.impl.SparseCheckoutPaths>
</extensions>


See also:

http://stackoverflow.com/questions/25943651/sparse-checkout-with-jenkins-dsl-plugin


Matt Sheehan

unread,
Sep 20, 2014, 10:38:30 PM9/20/14
to job-dsl...@googlegroups.com
Something like this should work:

job {
  scm {
    git {
      configure { node ->
        node / extensions {
          'hudson.plugins.git.extensions.impl.CloneOption' {
            shallow false
            reference '/build/jenkins/codebase.git'
          }
          'hudson.plugins.git.extensions.impl.SparseCheckoutPaths' {
            sparseCheckoutPaths {
              'hudson.plugins.git.extensions.impl.SparseCheckoutPath' {
                path 'BillOfMaterials.yml'
              }
              'hudson.plugins.git.extensions.impl.SparseCheckoutPath' {
                path 'jenkins/job/'
              }
            }
          }
        }
      }
    }
  }
}

--
You received this message because you are subscribed to the Google Groups "job-dsl-plugin" group.
To unsubscribe from this group and stop receiving emails from it, send an email to job-dsl-plugi...@googlegroups.com.
To post to this group, send email to job-dsl...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/job-dsl-plugin/fdc75e72-03a8-409c-ad72-883b46c362b0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Christian Goetze

unread,
Sep 21, 2014, 12:52:00 AM9/21/14
to job-dsl...@googlegroups.com
So that just works like that - thanks :)

--
You received this message because you are subscribed to a topic in the Google Groups "job-dsl-plugin" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/job-dsl-plugin/X47StCZYe58/unsubscribe.
To unsubscribe from this group and all its topics, send an email to job-dsl-plugi...@googlegroups.com.

To post to this group, send email to job-dsl...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages