代碼
stage("git") {
deleteDir()
checkout(
[
$class: 'GitSCM', branches: [[name: '*/dev']],
extensions: [
[$class: 'CloneOption', depth: 1,shallow: true,timeout: 2],
[$class: 'RelativeTargetDirectory', relativeTargetDir: 'devops']
],
userRemoteConfigs: [[credentialsId: 'aqx_git', url: 'https://aqx@192.168.1.2/cicd.git']]
]
)
}
解釋
deleteDir() #清除工作空間
GitSCM #指定拉取git的源碼
branches #設(shè)置拉取哪個(gè)分支
#shallow執(zhí)行淺克隆,depth設(shè)置淺克隆的深度,timeout指定克隆和獲取操作的超時(shí)時(shí)間(以分鐘為單位,默認(rèn)值:10)
[$class: 'CloneOption', depth: 1,shallow: true,timeout: 2]
[$class: 'RelativeTargetDirectory', relativeTargetDir: 'devops'] #檢出到子目錄devops下
credentialsId #git憑據(jù)
url #git倉(cāng)庫(kù)地址
參考文章
Jenkins的pipeline實(shí)踐之GitSCM參數(shù)配置項(xiàng)詳解原創(chuàng)文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-519605.html
文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-519605.html
到了這里,關(guān)于Jenkins Pipeline checkout scm拉取代碼的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!