Sparse Checkout with Jenkins DSL Plugin?

帅比萌擦擦* 提交于 2019-12-06 08:17:20
job('job1') {
    description 'sparse checkout example'
    scm {
        git {
            reference('/build/jenkins/codebase.git')
            configure { git ->
                git / 'extensions' / 'hudson.plugins.git.extensions.impl.SparseCheckoutPaths' / 'sparseCheckoutPaths' {
                    ['mypath1', 'mypath2', 'mypath3'].each { mypath ->
                        'hudson.plugins.git.extensions.impl.SparseCheckoutPath' {
                            path("${mypath}")
                        }
                    }
                }
            }
        }
    }
}

Adding onto the answer given by 'nbsp' I had to add the following bold keywords(enclosed within double asterisk if bold not visible) to get it working. Hope this helps someone. :)

configure { git ->
                git / 'extensions' / 'hudson.plugins.git.extensions.impl.SparseCheckoutPaths' {
                      **sparseCheckoutPaths {**
                            sparseCheckoutPath.each { checkoutPath ->
                               'hudson.plugins.git.extensions.impl.SparseCheckoutPath' {
                                    path("${checkoutPath}")
                                }
                            }
                      **}**
                }
           }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!