Correctly checking out patches when needed in the VOLTHA tests

Change-Id: I595cf3b43dee5b0d19abe14b9335c7dff59249e9
diff --git a/jjb/pipeline/voltha-bbsim-tests.groovy b/jjb/pipeline/voltha-bbsim-tests.groovy
index 3d91c7b..9fb741a 100644
--- a/jjb/pipeline/voltha-bbsim-tests.groovy
+++ b/jjb/pipeline/voltha-bbsim-tests.groovy
@@ -42,7 +42,6 @@
           $class: 'GitSCM',
           userRemoteConfigs: [[
             url: "https://gerrit.opencord.org/kind-voltha",
-            refspec: "${kindVolthaChange}"
           ]],
           branches: [[ name: "master", ]],
           extensions: [
@@ -51,6 +50,10 @@
             [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
           ],
         ])
+        sh """
+        cd $WORKSPACE/kind-voltha
+        git fetch https://gerrit.opencord.org/kind-voltha ${gerritRefspec} && git checkout FETCH_HEAD
+        """
       }
     }
     stage('Clone voltha-system-tests') {
@@ -59,7 +62,6 @@
           $class: 'GitSCM',
           userRemoteConfigs: [[
             url: "https://gerrit.opencord.org/voltha-system-tests",
-            refspec: "${volthaSystemTestsChange}"
           ]],
           branches: [[ name: "${branch}", ]],
           extensions: [
@@ -68,6 +70,10 @@
             [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
           ],
         ])
+        sh """
+        cd $WORKSPACE/voltha-system-tests
+        git fetch https://gerrit.opencord.org/voltha-system-tests ${volthaSystemTestsChange} && git checkout FETCH_HEAD
+        """
       }
     }
     // If the repo under test is not kind-voltha
@@ -83,7 +89,6 @@
           $class: 'GitSCM',
           userRemoteConfigs: [[
             url: "https://gerrit.opencord.org/${gerritProject}",
-            refspec: "${gerritRefspec}"
           ]],
           branches: [[ name: "${branch}", ]],
           extensions: [
@@ -94,6 +99,8 @@
         ])
         sh """
           pushd $WORKSPACE/${gerritProject}
+          git fetch https://gerrit.opencord.org/${gerritProject} ${gerritRefspec} && git checkout FETCH_HEAD
+
           echo "Currently on commit: \n"
           git log -1 --oneline
           popd