[VOL-3878] Using the patch under test when running sanity on voltha-helm-charts

Change-Id: Ie8120a2b03d78611935ebabdcd97eda0d82a24e1
diff --git a/jjb/pipeline/voltha/master/bbsim-tests.groovy b/jjb/pipeline/voltha/master/bbsim-tests.groovy
index c4cff5a..0dabbce 100644
--- a/jjb/pipeline/voltha/master/bbsim-tests.groovy
+++ b/jjb/pipeline/voltha/master/bbsim-tests.groovy
@@ -35,7 +35,12 @@
         extraHelmFlags = extraHelmFlags + customImageFlags("${gerritProject}")
       }
 
-      volthaDeploy([workflow: name, extraHelmFlags: extraHelmFlags])
+      def localCharts = false
+      if (gerritProject == "voltha-helm-charts") {
+        localCharts = true
+      }
+
+      volthaDeploy([workflow: name, extraHelmFlags: extraHelmFlags, localCharts: localCharts])
       // start logging
       sh """
       mkdir -p $WORKSPACE/${name}
diff --git a/vars/volthaDeploy.groovy b/vars/volthaDeploy.groovy
index 45e214d..dae88a8 100644
--- a/vars/volthaDeploy.groovy
+++ b/vars/volthaDeploy.groovy
@@ -15,6 +15,7 @@
       stackId: 1,
       workflow: "att",
       extraHelmFlags: "",
+      localCharts: false, // wether to use locally cloned charts or upstream one (for local we assume they are stored in $WORKSPACE/voltha-helm-charts)
     ]
 
     if (!config) {
diff --git a/vars/volthaInfraDeploy.groovy b/vars/volthaInfraDeploy.groovy
index ecea1ad..37f5846 100644
--- a/vars/volthaInfraDeploy.groovy
+++ b/vars/volthaInfraDeploy.groovy
@@ -19,6 +19,7 @@
       infraNamespace: "infra",
       workflow: "att",
       extraHelmFlags: "",
+      localCharts: false,
     ]
 
     if (!config) {
@@ -27,6 +28,18 @@
 
     def cfg = defaultConfig + config
 
+    def volthaInfraChart = "onf/voltha-infra"
+
+    if (cfg.localCharts) {
+      volthaInfraChart = "$WORKSPACE/voltha-helm-charts/voltha-infra"
+
+      sh """
+      pushd $WORKSPACE/voltha-helm-charts/voltha-infra
+      helm dep update
+      popd
+      """
+    }
+
     println "Deploying VOLTHA Infra with the following parameters: ${cfg}."
 
     sh """
@@ -35,7 +48,7 @@
     """
     // TODO support multiple replicas
     sh """
-    helm upgrade --install --create-namespace -n ${cfg.infraNamespace} voltha-infra onf/voltha-infra ${cfg.extraHelmFlags} \
+    helm upgrade --install --create-namespace -n ${cfg.infraNamespace} voltha-infra ${volthaInfraChart} ${cfg.extraHelmFlags} \
           -f $WORKSPACE/voltha-helm-charts/examples/${cfg.workflow}-values.yaml
     """
 }
diff --git a/vars/volthaStackDeploy.groovy b/vars/volthaStackDeploy.groovy
index c68de53..0b0d116 100644
--- a/vars/volthaStackDeploy.groovy
+++ b/vars/volthaStackDeploy.groovy
@@ -9,6 +9,7 @@
       stackId: 1, // NOTE this is used to differentiate between BBSims across multiple stacks
       workflow: "att",
       extraHelmFlags: "",
+      localCharts: false,
     ]
 
     if (!config) {
@@ -17,10 +18,22 @@
 
     def cfg = defaultConfig + config
 
+    def volthaStackChart = "onf/voltha-stack"
+
+    if (cfg.localCharts) {
+      volthaStackChart = "$WORKSPACE/voltha-helm-charts/voltha-stack"
+
+      sh """
+      pushd $WORKSPACE/voltha-helm-charts/voltha-stack
+      helm dep update
+      popd
+      """
+    }
+
     println "Deploying VOLTHA Stack with the following parameters: ${cfg}."
 
     sh """
-    helm upgrade --install --create-namespace -n ${cfg.volthaNamespace} ${cfg.stackName} onf/voltha-stack ${cfg.extraHelmFlags} \
+    helm upgrade --install --create-namespace -n ${cfg.volthaNamespace} ${cfg.stackName} ${volthaStackChart} ${cfg.extraHelmFlags} \
           --set global.stack_name=${cfg.stackName} \
           --set global.voltha_infra_name=voltha-infra \
           --set global.voltha_infra_namespace=${cfg.infraNamespace} \