Removing repo from nightly test-bbsim pipeline

Change-Id: Ia7b4be893e2c171dc1830adb9913d8c26356999a
diff --git a/jjb/pipeline/voltha-nightly-tests-bbsim.groovy b/jjb/pipeline/voltha-nightly-tests-bbsim.groovy
index f33ec7e..e286f1e 100644
--- a/jjb/pipeline/voltha-nightly-tests-bbsim.groovy
+++ b/jjb/pipeline/voltha-nightly-tests-bbsim.groovy
@@ -28,7 +28,7 @@
   environment {
     KUBECONFIG="$HOME/.kube/kind-config-voltha-minimal"
     VOLTCONFIG="$HOME/.volt/config-minimal"
-    PATH="$HOME/kind-voltha/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
+    PATH="$PATH:$WORKSPACE/kind-voltha/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
     TYPE="minimal"
     FANCY=0
     WITH_SIM_ADAPTERS="no"
@@ -43,35 +43,46 @@
     DIAGS_PROFILE="VOLTHA_PROFILE"
   }
   stages {
-
-    stage('Repo') {
-      steps {
-        step([$class: 'WsCleanup'])
-        checkout(changelog: true,
-          poll: false,
-          scm: [$class: 'RepoScm',
-            manifestRepositoryUrl: "${params.manifestUrl}",
-            manifestBranch: "${params.branch}",
-            currentBranch: true,
-            destinationDir: 'voltha',
-            forceSync: true,
-            resetFirst: true,
-            quiet: true,
-            jobs: 4,
-            showAllChanges: true]
-          )
-      }
-    }
-
-    stage('Download kind-voltha') {
+    stage('Cleanup') {
       steps {
         sh """
-           cd $HOME
-           [ -d kind-voltha ] || git clone https://gerrit.opencord.org/kind-voltha
-           rm -rf $HOME/kind-voltha/scripts/logger
-           cd $HOME/kind-voltha
-           git pull
-           """
+        cd $WORKSPACE/kind-voltha/
+        WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down || ./voltha down
+        """
+      }
+    }
+    stage('Clone kind-voltha') {
+      steps {
+        checkout([
+          $class: 'GitSCM',
+          userRemoteConfigs: [[
+            url: "https://gerrit.opencord.org/kind-voltha",
+            // refspec: "${kindVolthaChange}"
+          ]],
+          branches: [[ name: "master", ]],
+          extensions: [
+            [$class: 'WipeWorkspace'],
+            [$class: 'RelativeTargetDirectory', relativeTargetDir: "kind-voltha"],
+            [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
+          ],
+        ])
+      }
+    }
+    stage('Clone voltha-system-tests') {
+      steps {
+        checkout([
+          $class: 'GitSCM',
+          userRemoteConfigs: [[
+            url: "https://gerrit.opencord.org/voltha-system-tests",
+            // refspec: "${volthaSystemTestsChange}"
+          ]],
+          branches: [[ name: "${branch}", ]],
+          extensions: [
+            [$class: 'WipeWorkspace'],
+            [$class: 'RelativeTargetDirectory', relativeTargetDir: "voltha-system-tests"],
+            [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
+          ],
+        ])
       }
     }
 
@@ -81,15 +92,14 @@
            export EXTRA_HELM_FLAGS=""
            if [ "${branch}" != "master" ]; then
              echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}"
-             source "$HOME/kind-voltha/releases/${branch}"
+             source "$WORKSPACE/kind-voltha/releases/${branch}"
            else
              echo "on master, using default settings for kind-voltha"
            fi
 
-           EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${params.extraHelmFlags} "
+           EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${params.extraHelmFlags}"
 
-           cd $HOME/kind-voltha/
-           WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down || ./voltha down
+           cd $WORKSPACE/kind-voltha/
            ./voltha up
            """
       }
@@ -103,12 +113,12 @@
         sh '''
            set +e
            mkdir -p $ROBOT_LOGS_DIR
-           cd $HOME/kind-voltha/scripts
+           cd $WORKSPACE/kind-voltha/scripts
            ./log-collector.sh > /dev/null &
            ./log-combine.sh > /dev/null &
 
            export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR"
-           make -C $WORKSPACE/voltha/voltha-system-tests functional-single-kind || true
+           make -C $WORKSPACE/voltha-system-tests functional-single-kind || true
            '''
       }
     }
@@ -123,7 +133,7 @@
            mkdir -p $WORKSPACE/RobotLogs
 
            export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR"
-           make -C $WORKSPACE/voltha/voltha-system-tests bbsim-alarms-kind || true
+           make -C $WORKSPACE/voltha-system-tests bbsim-alarms-kind || true
            '''
       }
     }
@@ -138,7 +148,7 @@
            mkdir -p $WORKSPACE/RobotLogs
 
            export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR"
-           make -C $WORKSPACE/voltha/voltha-system-tests bbsim-failurescenarios || true
+           make -C $WORKSPACE/voltha-system-tests bbsim-failurescenarios || true
            '''
       }
     }
@@ -153,7 +163,7 @@
            mkdir -p $WORKSPACE/RobotLogs
 
            export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR"
-           make -C $WORKSPACE/voltha/voltha-system-tests bbsim-errorscenarios || true
+           make -C $WORKSPACE/voltha-system-tests bbsim-errorscenarios || true
            '''
       }
     }
@@ -163,7 +173,7 @@
     always {
       sh '''
          set +e
-         cp $HOME/kind-voltha/install-minimal.log $WORKSPACE/
+         cp $WORKSPACE/kind-voltha/install-minimal.log $WORKSPACE/
          kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq
          kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq
          kubectl get nodes -o wide
@@ -176,14 +186,14 @@
          extract_errors_go() {
            echo
            echo "Error summary for $1:"
-           grep '"level":"error"' $HOME/kind-voltha/scripts/logger/combined/$1*
+           grep '"level":"error"' $WORKSPACE/kind-voltha/scripts/logger/combined/$1*
            echo
          }
 
          extract_errors_python() {
            echo
            echo "Error summary for $1:"
-           grep 'ERROR' $HOME/kind-voltha/scripts/logger/combined/$1*
+           grep 'ERROR' $WORKSPACE/kind-voltha/scripts/logger/combined/$1*
            echo
          }
 
@@ -195,14 +205,14 @@
 
          gzip error-report.log || true
 
-         cd $HOME/kind-voltha/scripts/logger/combined/
+         cd $WORKSPACE/kind-voltha/scripts/logger/combined/
          tar czf $WORKSPACE/container-logs.tgz *
 
          cd $WORKSPACE
          gzip *-combined.log || true
 
          ## shut down voltha but leave kind-voltha cluster
-         cd $HOME/kind-voltha/
+         cd $WORKSPACE/kind-voltha/
          DEPLOY_K8S=n WAIT_ON_DOWN=y ./voltha down
          kubectl delete deployment voltctl || true
          '''
diff --git a/jjb/voltha-e2e.yaml b/jjb/voltha-e2e.yaml
index 26690cb..63649e9 100644
--- a/jjb/voltha-e2e.yaml
+++ b/jjb/voltha-e2e.yaml
@@ -137,6 +137,8 @@
     robot-args: ''
     gerrit-project: ''
     work-flow: ''
+    volthaSystemTestsChange: ''
+    kindVolthaChange: ''
     sandbox: true
 
     description: |
@@ -215,6 +217,16 @@
           default: '{karaf-home}'
           description: 'Karaf home'
 
+      - string:
+          name: volthaSystemTestsChange
+          default: '{volthaSystemTestsChange}'
+          description: 'Download a change for gerrit in the voltha-system-tests repo, example value: "refs/changes/79/18779/13"'
+
+      - string:
+          name: kindVolthaChange
+          default: '{kindVolthaChange}'
+          description: 'Download a change for gerrit in the kind-voltha repo, example value: "refs/changes/32/19132/1"'
+
     project-type: pipeline
     concurrent: true