前台需要下载安装 Git Parameter 插件

1,pipeline中

pipeline {
    agent any
    stages {
        stage('checkout') {
            steps {
                checkout([
                    $class: 'GitSCM', 
                    branches: [[name: "${params.gitBranch}"]], 
                    doGenerateSubmoduleConfigurations: false, 
                    extensions: [
                        [$class: 'SparseCheckoutPaths',  sparseCheckoutPaths:[[$class:'SparseCheckoutPath', path:'yourDirOrFilePath']]]    
                    ], 
                    submoduleCfg: [], 
                    userRemoteConfigs: [[credentialsId: 'yourid', 
                    url: 'yourGitUrl']]
                ])
            }
        }
    }
}

2,在界面中

jenkins git 拉取指定目录和文件

 

相关文章:

  • 2022-12-23
  • 2021-09-12
  • 2022-12-23
  • 2022-12-23
  • 2021-08-07
  • 2022-12-23
  • 2021-11-20
猜你喜欢
  • 2021-08-22
  • 2022-12-23
  • 2022-02-19
  • 2022-12-23
  • 2021-08-08
相关资源
相似解决方案