| // 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 |
| [$class: 'CleanCheckout'], |
| [$class: 'BuildChooserSetting', buildChooser: [$class: 'GerritTriggerBuildChooser']] |
| // if we need to "merge" code from patchset to GERRIT_BRANCH branch |
| scmExtensions.add([$class: 'LocalBranch', localBranch: "${GERRIT_BRANCH}"]) |
| // we need wipe workspace before checkout |
| scmExtensions.add([$class: 'WipeWorkspace']) |
| branches: [[name: "${GERRIT_BRANCH}"]], |
| extensions: scmExtensions, |
| credentialsId: "${config.credentialsId}", |
| url: "ssh://${GERRIT_NAME}@${GERRIT_HOST}:${GERRIT_PORT}/${GERRIT_PROJECT}.git", |
| refspec: "${GERRIT_REFSPEC}" |