blob: 0bb696ff4eaa0776a7de76be988de3694d36a1ea [file] [log] [blame]
Sergey Kulanov72f763e2016-09-29 17:08:44 +03001def call(body) {
2 // evaluate the body block, and collect configuration into the object
3 def config = [:]
4 body.resolveStrategy = Closure.DELEGATE_FIRST
5 body.delegate = config
6 body()
7
Igor Belikov4dc96cd2016-09-30 12:26:18 +03008 def targetDir = config.targetDir ?: "./"
Sergey Kulanov72f763e2016-09-29 17:08:44 +03009 def port = config.port ?: "29418"
10
Sergey Kulanov0a7c17c2016-09-30 17:47:22 +030011 checkout(
12 scm: [
13 $class: 'GitSCM',
14 branches: [[name: "${config.branch}"]],
15 extensions: [
16 [$class: 'CleanCheckout'],
17 [$class: 'RelativeTargetDirectory', relativeTargetDir: "${targetDir}"]
18 ],
19 userRemoteConfigs: [[
20 credentialsId: "${config.credentialsId}",
21 name: 'origin',
22 url: "ssh://${config.credentialsId}@${config.host}:${port}/${config.project}.git"
23 ]]
24 ]
25 )
Sergey Kulanov72f763e2016-09-29 17:08:44 +030026}