19 lines
491 B
Groovy
19 lines
491 B
Groovy
// 拉取git仓库指定分支代码
|
|
def call (Map config = [:]) {
|
|
echo "--> 拉取代码开始"
|
|
def branch = config.branch
|
|
def url = config.url
|
|
def credentialId = config.credentialId
|
|
checkout([
|
|
$class: 'GitSCM',
|
|
branches: [[name: "*/${branch}"]],
|
|
doGenerateSubmoduleConfigurations: false,
|
|
extensions: [],
|
|
submoduleCfg: [],
|
|
userRemoteConfigs: [[
|
|
url: "${url}",
|
|
credentialsId: "${credentialId}"
|
|
]]
|
|
])
|
|
echo "--> 拉取代码成功"
|
|
} |