Clean way for checkout scm minus sparse?

6 views
Skip to first unread message

Marc Guillemot

unread,
Dec 13, 2021, 8:37:15 AM12/13/21
to jenkins...@googlegroups.com
Hi,

we have a quite heavy git repository therefore we configure sparse
checkout for the associated multibranch pipeline job running builds in
containers. The complete checkout is required in the containers (scm
with original configuration from the job except the sparse
configuration). We achieve this currently with a step in a custom
pipeline library:

// ---- Jenkinsfile ---
...
podTemplate(cloud: 'kubernetes-svr-rancher....', yaml: podYaml) {
node(POD_LABEL) {
checkout customScmWithoutSparseConfig()
...
}
}

// ---- pipeline step customScmWithoutSparseConfig ---
def call() {
// weird: working directly on variable scm doesn't work, checkout is
then still performed with sparse config
def modifiedScm = scm

modifiedScm.extensions.remove(hudson.plugins.git.extensions.impl.SparseCheckoutPaths)
return modifiedScm
}


This solution is working for us but it rather looks like a hack than
like a clean way.

Is there a better, cleaner way to perform a checkout without the sparse
settings configured in the multibranch pipeline job?

Cheers
Marc
Reply all
Reply to author
Forward
0 new messages