Gerrit checkout updated to use env params.
Change-Id: Ibe0d7770393cb56b576cf9a552410859d1beb023
diff --git a/src/com/mirantis/mk/Gerrit.groovy b/src/com/mirantis/mk/Gerrit.groovy
index f389df5..81e165b 100644
--- a/src/com/mirantis/mk/Gerrit.groovy
+++ b/src/com/mirantis/mk/Gerrit.groovy
@@ -39,21 +39,21 @@
]
def scmUserRemoteConfigs = [
name: 'gerrit',
- refspec: config.get('gerritRefSpec','')
+ refspec: "${GERRIT_REFSPEC}"
]
if (credentials == '') {
// then try to checkout in anonymous mode
- scmUserRemoteConfigs.put('url', config.get('gerritUrl',''))
+ scmUserRemoteConfigs.put('url',"https://${GERRIT_HOST}/${GERRIT_PROJECT}")
} else {
// else use ssh checkout
- scmUserRemoteConfigs.put('url',config.get('gerritUrl',''))
+ scmUserRemoteConfigs.put('url',"ssh://${GERRIT_NAME}@${GERRIT_HOST}:${GERRIT_PORT}/${GERRIT_PROJECT}.git")
scmUserRemoteConfigs.put('credentialsId',credentials)
}
// if we need to "merge" code from patchset to GERRIT_BRANCH branch
if (merge) {
- scmExtensions.add([$class: 'LocalBranch', localBranch: config.get('gerritBranch','master')])
+ scmExtensions.add([$class: 'LocalBranch', localBranch: "${GERRIT_BRANCH}"])
}
// we need wipe workspace before checkout
if (wipe) {
@@ -63,7 +63,7 @@
checkout(
scm: [
$class: 'GitSCM',
- branches: [[name: config.get('gerritBranch','master')]],
+ branches: [[name: "${GERRIT_BRANCH}"]],
extensions: scmExtensions,
userRemoteConfigs: [scmUserRemoteConfigs]
]