Merge "Better timeout handling in BBSim test pipeline: - defining individual timeout per build and test phases - preloading voltha-system-tests virtual environment"
diff --git a/jjb/pipeline/voltha/master/bbsim-tests.groovy b/jjb/pipeline/voltha/master/bbsim-tests.groovy
index 772723f..6bcc5ba 100644
--- a/jjb/pipeline/voltha/master/bbsim-tests.groovy
+++ b/jjb/pipeline/voltha/master/bbsim-tests.groovy
@@ -33,7 +33,7 @@
         }
 
         def localCharts = false
-        if (gerritProject == "voltha-helm-charts") {
+        if (gerritProject == "voltha-helm-charts" || branch != "master") {
           localCharts = true
         }
 
diff --git a/jjb/pipeline/voltha/voltha-2.7/bbsim-tests.groovy b/jjb/pipeline/voltha/voltha-2.7/bbsim-tests.groovy
index c72c0f9..4cf748a 100644
--- a/jjb/pipeline/voltha/voltha-2.7/bbsim-tests.groovy
+++ b/jjb/pipeline/voltha/voltha-2.7/bbsim-tests.groovy
@@ -23,58 +23,26 @@
       remote: 'https://gerrit.opencord.org/ci-management.git'
 ])
 
-// TODO move this in a keyword so it can be shared across pipelines
-def customImageFlags(project) {
-  def chart = "unknown"
-  def image = "unknown"
-  switch(project) {
-    case "ofagent-go":
-      chart = "voltha"
-      image = "ofagent"
-    break
-    case "voltha-go":
-      chart = "voltha"
-      image = "rw_core"
-    break
-    case "voltha-openonu-adapter-go":
-      chart = "voltha-adapter-openonu"
-      image = "adapter_open_onu_go"
-    break
-    // TODO remove after 2.7
-    case "voltha-openonu-adapter":
-      chart = "voltha-adapter-openonu"
-      image = "adapter_open_onu"
-    break
-    // TODO end
-    case "voltha-openolt-adapter":
-      chart = "voltha-adapter-openolt"
-      image = "adapter_open_olt"
-    break
-    case "bbsim":
-      // BBSIM has a different format that voltha, return directly
-      return "--set images.bbsim.tag=citest,images.bbsim.pullPolicy=Never"
-    break
-    default:
-    break
-  }
-
-  return "--set ${chart}.images.${image}.tag=citest,${chart}.images.${image}.pullPolicy=Never "
-}
-
 def test_workflow(name) {
+  timeout(time: 10, unit: 'MINUTES') {
   stage('Deploy - '+ name + ' workflow') {
       def extraHelmFlags = "${extraHelmFlags} --set global.log_level=DEBUG,onu=1,pon=1 "
 
       if (gerritProject != "") {
-        extraHelmFlags = extraHelmFlags + customImageFlags("${gerritProject}")
+        extraHelmFlags = extraHelmFlags + getVolthaImageFlags("${gerritProject}")
       }
 
       def localCharts = false
-      if (gerritProject == "voltha-helm-charts") {
+      if (gerritProject == "voltha-helm-charts" || branch != "master") {
         localCharts = true
       }
 
-      volthaDeploy([workflow: name, extraHelmFlags: extraHelmFlags, localCharts: localCharts])
+      volthaDeploy([
+        workflow: name,
+        extraHelmFlags: extraHelmFlags,
+        localCharts: localCharts,
+        dockerRegistry: "mirror.registry.opennetworking.org"
+      ])
       // start logging
       sh """
       mkdir -p $WORKSPACE/${name}
@@ -86,6 +54,7 @@
       _TAG=onos-port-forward kubectl port-forward --address 0.0.0.0 -n infra svc/voltha-infra-onos-classic-hs 8181:8181&
       _TAG=voltha-port-forward kubectl port-forward --address 0.0.0.0 -n voltha svc/voltha-voltha-api 55555:55555&
       """
+    }
   }
   stage('Test VOLTHA - '+ name + ' workflow') {
       sh """