| // evaluate the body block, and collect configuration into the object |
| body.resolveStrategy = Closure.DELEGATE_FIRST |
| def merge = config.withMerge ?: false |
| def wipe = config.withWipeOut ?: false |
| def targetDir = config.targetDir ?: "./" |
| def port = config.port ?: "29418" |
| [$class: 'CleanCheckout'], |
| [$class: 'RelativeTargetDirectory', relativeTargetDir: "${targetDir}"] |
| // https://issues.jenkins-ci.org/browse/JENKINS-6856 |
| scmExtensions.add([$class: 'LocalBranch', localBranch: "${config.branch}"]) |
| // we need wipe workspace before checkout |
| scmExtensions.add([$class: 'WipeWorkspace']) |
| branches: [[name: "${config.branch}"]], |
| extensions: scmExtensions, |
| credentialsId: "${config.credentialsId}", |
| url: "ssh://${config.credentialsId}@${config.host}:${port}/${config.project}.git" |