问题描述
在 jenkinsfile 中,我已经通过 SparseCheckoutPaths 指定了要签出的文件夹名称.但我得到的是整个分支机构的结帐.
In a jenkinsfile, I have specified the folderName through SparseCheckoutPaths which I want to checkout. But I am getting a whole branch checkout instead.
checkout([$class: 'GitSCM',
branches: [[name: '*/branchName']],
extensions: [[$class: 'SparseCheckoutPaths', path: 'FolderName']],
userRemoteConfigs: [[credentialsId: 'someID',
url: '[email protected]']]])
推荐答案
这里是我自己问题的答案.对于它是如何工作的一些背景知识,git 客户端有一个名为 sparsecheckout 的标志/配置,它负责这种结帐.此外,还需要一个 sparse-checkout 命名文件.有关更多信息,请查看 这里.
Here comes the answer to my own question. For a bit of background how does it work, there is flag/configuration for git client called sparsecheckout which is responsible for this kind of checkout. Additionally, a sparse-checkout named file is also required. For more info look here.
我的问题是 Jenkinsfile 的语法,正确的语法如下:
My problem was the syntax for the Jenkinsfile and correct one is as follows:
checkout([$class: 'GitSCM',
branches: [[name: '*/branchName']],
doGenerateSubmoduleConfigurations: false,
extensions: [
[$class: 'SparseCheckoutPaths', sparseCheckoutPaths:[[$class:'SparseCheckoutPath', path:'folderName/']]]
],
submoduleCfg: [],
userRemoteConfigs: [[credentialsId: 'someID',
url: '[email protected]']]])
欲了解更多信息,请访问 github-link
for more info, here comes the github-link
这篇关于Jenkinsfile 管道中的 SparseCheckout的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!