Enable debugging for repo:onos job

Change-Id: Id79a74a4773151b01d7d30cc31b058fcff68f5fb
diff --git a/vars/volthaDeploy.groovy b/vars/volthaDeploy.groovy
index 1c28bba..1d83306 100644
--- a/vars/volthaDeploy.groovy
+++ b/vars/volthaDeploy.groovy
@@ -15,7 +15,8 @@
 // limitations under the License.
 // -----------------------------------------------------------------------
 // this keyword is dedicated to deploy a single VOLTHA stack with infra
-// If you need to deploy different configurations you can use the volthaInfraDeploy and volthaStackDeploy keywords
+// If you need to deploy different configurations you can use the
+// volthaInfraDeploy and volthaStackDeploy DSL keywords
 // -----------------------------------------------------------------------
 
 // -----------------------------------------------------------------------
@@ -48,13 +49,23 @@
 }
 
 // -----------------------------------------------------------------------
+// Intent: Display a message with visibility for logging
+// -----------------------------------------------------------------------
+String banner(String message) {
+    println("""
+
+** -----------------------------------------------------------------------
+** ${message}
+** -----------------------------------------------------------------------
+""")
+    return
+}
+
+// -----------------------------------------------------------------------
 // Intent: Perform volthaDeploy stuff
 // -----------------------------------------------------------------------
-def call(Map config) {
-
-    // String iam = 'vars/volthaDeploy.groovy'
-    enter('main')
-
+void process(Map config)
+{
     // note that I can't define this outside the function as there's no global scope in Groovy
     // [joey] A class method or library call can be used in place of globals, fqdn needed.
     def defaultConfig = [
@@ -63,16 +74,16 @@
         kafkaReplica: 1,
         etcdReplica: 1,
         bbsimReplica: 1,
-        infraNamespace: "infra",
-        volthaNamespace: "voltha",
-        stackName: "voltha",
+        infraNamespace   : 'infra',
+        volthaNamespace  : 'voltha',
+        stackName        : 'voltha',
         stackId: 1,
-        workflow: "att",
+        workflow         : 'att',
         withMacLearning: false,
         withFttb: false,
-        extraHelmFlags: "",
-        localCharts: false, // wether to use locally cloned charts or upstream one (for local we assume they are stored in $WORKSPACE/voltha-helm-charts)
-        dockerRegistry: "", // use a different docker registry for all images, eg: "mirror.registry.opennetworking.org"
+        extraHelmFlags   : '',
+        localCharts: false, // Local or upstream (?) (for local we assume they are stored in $WORKSPACE/voltha-helm-charts)
+        dockerRegistry   : '', // Different registry for images eg: "mirror.registry.opennetworking.org"
         kubeconfig: null, // location of the kubernetes config file, if null we assume it's stored in the $KUBECONFIG environment variable
         withVolthaInfra: true,
         withVolthaStack: true,
@@ -84,7 +95,7 @@
 
     def cfg = defaultConfig + config
 
-    if (cfg.dockerRegistry != "") {
+    if (cfg.dockerRegistry != '') {
         def registryFlags = " --set global.image_registry=${cfg.dockerRegistry}/ "
         registryFlags += " --set etcd.image.registry=${cfg.dockerRegistry} "
         registryFlags += " --set kafka.image.registry=${cfg.dockerRegistry} "
@@ -97,8 +108,8 @@
         cfg.extraHelmFlags = registryFlags + " " + cfg.extraHelmFlags
     }
 
-    // Add helm repositories
-    println "Updating helm repos"
+    // ---------------------
+    banner("Updating helm repos")
 
     sh(label  : 'Configure helm repo',
        script : """
@@ -106,7 +117,8 @@
 helm repo update
 """)
 
-    println "Deploying VOLTHA with the following parameters: ${cfg}."
+    // ---------------------
+    banner("Deploying VOLTHA with the following parameters: ${cfg}")
 
     if (cfg.withVolthaInfra) {
         volthaInfraDeploy(cfg)
@@ -116,7 +128,29 @@
         volthaStackDeploy(cfg)
     }
 
-    leave('main')
+    return
+}
+
+// -----------------------------------------------------------------------
+// -----------------------------------------------------------------------
+def call(Map config=[:]) { // Function return type(?)
+    String iam = getIam('main')
+    Boolean ans = true
+
+    try {
+        enter('main')
+        process(config)
+    }
+    catch (Exception err) {  // groovylint-disable-line CatchException
+        ans = false
+        println("** ${iam}: EXCEPTION ${err}")
+        throw err
+    }
+    finally {
+        leave('main')
+    }
+
+    return(ans)
 }
 
 // [EOF]
diff --git a/vars/volthaStackDeploy.groovy b/vars/volthaStackDeploy.groovy
index f04e62a..5ccae56 100644
--- a/vars/volthaStackDeploy.groovy
+++ b/vars/volthaStackDeploy.groovy
@@ -135,7 +135,7 @@
 EOM
 
 # set -euo pipefail
-set +x #                 # Logs are noisy when commented
+set +x #                 # Logs are noisy with set -x
 
 declare -i count=0
 declare -i debug=1       # uncomment to enable debugging
@@ -234,7 +234,7 @@
 
 declare -i count=0
 declare -i debug=1       # uncomment to enable debugging
-# declare -i verbose=1   # uncomment to enable debugging
+declare -i verbose=1     # uncomment to enable debugging
 vsd_log='volthaStackDeploy.tmp'
 echo > \$vsd_log