本文介绍了Jenkinsfile管道中的SparseCheckout的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在jenkins文件中,我通过 SparseCheckoutPaths 指定了要检出的文件夹名称。但是我得到了一个分支结账。

  checkout([$ class:'GitSCM',
branches: [[name:'* / branchName']],
extensions:[[$ class:'SparseCheckoutPaths',path:'FolderName']],
userRemoteConfigs:[[credentialsId:'someID',
url:'[email protected]']]])


解决方案 div>

这是我自己的问题的答案。对于一些背景,它是如何工作的,git客户端的标志/配置称为 sparsecheckout ,它负责这种结帐。另外,还需要一个稀疏检出命名文件。欲了解更多信息,请看。



我的问题是 Jenkinsfile 的语法,正确的如下所示:

  checkout([$ class:'GitSCM',
branches:[[name:'* / branchName']],
doGenerateSubmoduleConfigurations :false,
扩展:[
[$ class:'SparseCheckoutPaths',sparseCheckoutPaths:[[$ class:'SparseCheckoutPath',pathName:'folderName /']]]
],
submoduleCfg:[],
userRemoteConfigs:[[credentialsId:'someID',
url:'[email protected]']]])

了解更多信息,请参阅


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]']]])
解决方案

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.

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]']]])

for more info, here comes the github-link

这篇关于Jenkinsfile管道中的SparseCheckout的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 05:20