blob: 6f52d9b26d6204182abe61a6d1fa169526fe8fb8 [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
11 stage("Git Checkout"){
12 checkout(
13 scm: [
14 $class: 'GitSCM',
15 branches: [[name: "${config.branch}"]],
16 extensions: [
17 [$class: 'CleanCheckout'],
Igor Belikov4dc96cd2016-09-30 12:26:18 +030018 [$class: 'RelativeTargetDirectory', relativeTargetDir: "${targetDir}"]
Sergey Kulanov72f763e2016-09-29 17:08:44 +030019 ],
20 userRemoteConfigs: [[
21 credentialsId: "${config.credentialsId}",
22 name: 'origin',
23 url: "ssh://${config.credentialsId}@${config.host}:${port}/${config.project}.git"
24 ]]
25 ]
26 )
27 }
28}