Downloading patches under tests

Change-Id: I14f7dbb1ea54ec0f14a98efaafa8516ca11b917d
diff --git a/jjb/pipeline/voltha-bbsim-tests.groovy b/jjb/pipeline/voltha-bbsim-tests.groovy
index 3d91c7b..b990a45 100644
--- a/jjb/pipeline/voltha-bbsim-tests.groovy
+++ b/jjb/pipeline/voltha-bbsim-tests.groovy
@@ -51,6 +51,12 @@
             [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
           ],
         ])
+        sh """
+        if [ '${kindVolthaChange}' != '' ] ; then
+          cd $WORKSPACE/kind-voltha
+          git fetch https://gerrit.opencord.org/kind-voltha ${kindVolthaChange} && git checkout FETCH_HEAD
+        fi
+        """
       }
     }
     stage('Clone voltha-system-tests') {
@@ -68,6 +74,12 @@
             [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
           ],
         ])
+        sh """
+        if [ '${volthaSystemTestsChange}' != '' ] ; then
+          cd $WORKSPACE/voltha-system-tests
+          git fetch https://gerrit.opencord.org/voltha-system-tests ${volthaSystemTestsChange} && git checkout FETCH_HEAD
+        fi
+        """
       }
     }
     // If the repo under test is not kind-voltha
@@ -94,6 +106,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