前台需要下载安装 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,在界面中
