VOL-4795 - Researching community pod faiure.

.gitignore
----------
   o Add exclusions so npm-groovy-lint can be used.

vars/getVolthaCode.groovy
-------------------------
   o Added an iam() method to self-identfy the scirpt.
   o Wrap call() logic in a try/catch block so problems are always visible.
   o groovy-lint - declare local vars to shorten long lines.
   o Add whitespace and separation for readability.

Include more sources to trigger a jenkins build.

Change-Id: I50be0be0dbd69da55d6aad5c48bc6ef832056afc
diff --git a/.gitignore b/.gitignore
index f07503c..0506491 100644
--- a/.gitignore
+++ b/.gitignore
@@ -33,3 +33,9 @@
 venv-jjb
 job-configs
 
+# npm-groovy-lint
+node_modules/
+package-lock.json
+package.json
+
+# [EOF]
diff --git a/jjb/bbr.yaml b/jjb/bbr.yaml
index 14b4caa..5d756bc 100644
--- a/jjb/bbr.yaml
+++ b/jjb/bbr.yaml
@@ -22,7 +22,7 @@
                   Interval scale tests for BBSim using BBR <br />
                   Created from job-template bbsim_scale_test from ci-management/jjb/bbr.yaml <br />
                   Created by Matteo Scandolo, teo@opennetworking.org <br />
-                  Copyright (c) 2017 Open Networking Foundation (ONF)
+                  Copyright 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors
 
     project-type: pipeline
     sandbox: true
diff --git a/jjb/cord-test/nightly-build-pipeline.yaml b/jjb/cord-test/nightly-build-pipeline.yaml
index 7ff3007..4f20609 100644
--- a/jjb/cord-test/nightly-build-pipeline.yaml
+++ b/jjb/cord-test/nightly-build-pipeline.yaml
@@ -21,7 +21,7 @@
                   Manual Build on POD {config-pod} using {Jenkinsfile}<br /><br />
                   Created from job-template {id} from ci-management/jjb/cord-test/nightly-build-pipeline.yaml <br />
                   Created by QA (Suchitra Vemuri - suchitra@opennetworking.org ) <br />
-                  Copyright (c) 2018 Open Networking Foundation (ONF)
+                  Copyright 2018-2023 Open Networking Foundation (ONF) and the ONF Contributors
 
     openoltAdapterChart: onf/voltha-adapter-openolt
 
@@ -172,8 +172,7 @@
     description: |
                   Nightly Kubernetes tests on {config-pod} using {Jenkinsfile}<br /><br />
                   Created from job-template {id} from ci-management/jjb/cord-test/nightly-build-pipeline.yaml<br />
-                  Created by Suchitra Vemuri, suchitra@opennetworking.org <br />
-                  Copyright (c) 2017 Open Networking Foundation (ONF)
+                  Created by Suchitra Vemuri, suchitra@opennetworking.org <br />                  Copyright 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors
     disabled: '{disable-job}'
 
     <<: *test-pipe-job-boiler-plate
@@ -302,8 +301,7 @@
     description: |
                   Post Tests on {config-pod} triggered by build_{config-pod}_{branch}, using {Jenkinsfile}<br /><br />
                   Created from job-template {id} from ci-management/jjb/cord-test/nightly-build-pipeline.yaml <br />
-                  Created by Kailash Khalasi - kailash@opennetworking.org <br />
-                  Copyright (c) 2017 Open Networking Foundation (ONF)
+                  Created by Kailash Khalasi - kailash@opennetworking.org <br />                  Copyright 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors
 
     <<: *test-pipe-job-boiler-plate
 
@@ -374,7 +372,7 @@
                   Manual Build on POD {config-pod}, using {Jenkinsfile}<br /><br />
                   Created from job-template {id} from ci-management/jjb/cord-test/nightly-build-pipeline.yaml <br />
                   Created by QA (Suchitra Vemuri - suchitra@opennetworking.org ) <br />
-                  Copyright (c) 2018 Open Networking Foundation (ONF)
+                  Copyright 2018-2023 Open Networking Foundation (ONF) and the ONF Contributors
 
     <<: *test-pipe-job-boiler-plate
 
@@ -465,7 +463,7 @@
                   Manual Build on POD {config-pod}, using {Jenkinsfile}<br /><br />
                   Created from job-template {id} from ci-management/jjb/cord-test/nightly-build-pipeline.yaml <br />
                   Created by QA (Suchitra Vemuri - suchitra@opennetworking.org ) <br />
-                  Copyright (c) 2018 Open Networking Foundation (ONF)
+                  Copyright 2018-2023 Open Networking Foundation (ONF) and the ONF Contributors
 
     <<: *test-pipe-job-boiler-plate
 
@@ -566,7 +564,7 @@
                   Post Tests on {config-pod} triggered by build_{config-pod}_{branch}, using {Jenkinsfile} <br /><br />
                   Created from job-template {id} from ci-management/jjb/cord-test/nightly-build-pipeline.yaml <br />
                   Created by Kailash Khalasi - kailash@opennetworking.org <br />
-                  Copyright (c) 2017 Open Networking Foundation (ONF)
+                  Copyright 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors
 
     <<: *test-pipe-job-boiler-plate
 
@@ -638,7 +636,7 @@
                   Post Tests on {config-pod} triggered by build_{config-pod}_{branch}, using {Jenkinsfile}<br /><br />
                   Created from job-template {id} from ci-management/jjb/cord-test/nightly-build-pipeline.yaml <br />
                   Created by Kailash Khalasi - kailash@opennetworking.org <br />
-                  Copyright (c) 2017 Open Networking Foundation (ONF)
+                  Copyright 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors
 
     <<: *test-pipe-job-boiler-plate
 
@@ -710,7 +708,7 @@
                   Manual Build on POD {config-pod}, using {Jenkinsfile} <br /><br />
                   Created from job-template {id} from ci-management/jjb/cord-test/nightly-build-pipeline.yaml <br />
                   Created by QA (Kailash Khalasi - kailash@opennetworking.org ) <br />
-                  Copyright (c) 2019 Open Networking Foundation (ONF)
+                  Copyright 2019-2023 Open Networking Foundation (ONF) and the ONF Contributors
 
     <<: *test-pipe-job-boiler-plate
 
diff --git a/jjb/fossa.yaml b/jjb/fossa.yaml
index acfa347..5deeba0 100644
--- a/jjb/fossa.yaml
+++ b/jjb/fossa.yaml
@@ -20,7 +20,7 @@
     description: |
                   Post-merge check of code with fossa toolset
                   Created by {id} job-template from ci-management/jjb/fossa.yaml<br/>
-                  Copyright (c) 2018-present Open Networking Foundation (ONF)
+                  Copyright 2018-2023 Open Networking Foundation (ONF) and the ONF Contributors
 
     properties:
       - cord-infra-properties:
diff --git a/jjb/pipeline/docker-publish.groovy b/jjb/pipeline/docker-publish.groovy
index 316d429..9e3f9f9 100644
--- a/jjb/pipeline/docker-publish.groovy
+++ b/jjb/pipeline/docker-publish.groovy
@@ -1,4 +1,4 @@
-// Copyright 2017-present Open Networking Foundation
+// Copyright 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
diff --git a/jjb/pipeline/omec-postmerge.groovy b/jjb/pipeline/omec-postmerge.groovy
index 06e2be2..2abcf49 100644
--- a/jjb/pipeline/omec-postmerge.groovy
+++ b/jjb/pipeline/omec-postmerge.groovy
@@ -1,4 +1,4 @@
-// Copyright 2020-present Open Networking Foundation
+// Copyright 2020-2023 Open Networking Foundation (ONF) and the ONF Contributors
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
diff --git a/jjb/pipeline/onos-app-release.groovy b/jjb/pipeline/onos-app-release.groovy
index dc022e1..4cd3011 100644
--- a/jjb/pipeline/onos-app-release.groovy
+++ b/jjb/pipeline/onos-app-release.groovy
@@ -1,4 +1,4 @@
-// Copyright 2019-present Open Networking Foundation
+// Copyright 2019-2023 Open Networking Foundation (ONF) and the ONF Contributors
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
diff --git a/jjb/pipeline/xos-core.groovy b/jjb/pipeline/xos-core.groovy
index e3f398b..8962545 100644
--- a/jjb/pipeline/xos-core.groovy
+++ b/jjb/pipeline/xos-core.groovy
@@ -1,4 +1,4 @@
-// Copyright 2017-present Open Networking Foundation
+// Copyright 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
diff --git a/jjb/shell/make-unit.sh b/jjb/shell/make-unit.sh
index a6920e3..c28a59e 100755
--- a/jjb/shell/make-unit.sh
+++ b/jjb/shell/make-unit.sh
@@ -1,6 +1,6 @@
 #!/usr/bin/env bash
 
-# Copyright 2019-present Open Networking Foundation
+# Copyright 2019-2023 Open Networking Foundation (ONF) and the ONF Contributors
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
diff --git a/jjb/shell/shcheck.sh b/jjb/shell/shcheck.sh
index 2abe89c..48ffc7d 100755
--- a/jjb/shell/shcheck.sh
+++ b/jjb/shell/shcheck.sh
@@ -1,6 +1,6 @@
 #!/usr/bin/env bash
 
-# Copyright 2017-present Open Networking Foundation
+# Copyright 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
diff --git a/jjb/voltha-e2e.yaml b/jjb/voltha-e2e.yaml
index 0fc2edf..f16969a 100755
--- a/jjb/voltha-e2e.yaml
+++ b/jjb/voltha-e2e.yaml
@@ -1989,7 +1989,7 @@
                   Automated build on POD {config-pod} using {pipeline-script} <br /><br />
                   Created from job-template {id} from ci-management/jjb/voltha-e2e.yaml <br />
                   Created by Andy Bavier, andy@opennetworking.org <br />
-                  Copyright (c) 2019 Open Networking Foundation (ONF)
+                  Copyright 2019-2023 Open Networking Foundation (ONF) and the ONF Contributors
     sandbox: true
     pipeline-script: 'voltha/master/tucson-build-and-test.groovy'
     default-test-args: '-i sanityORDeleteOLT -i PowerSwitch -X'
@@ -2042,7 +2042,7 @@
                   Automated build on POD {config-pod} using {pipeline-script} <br /><br />
                   Created from job-template {id} from ci-management/jjb/voltha-e2e.yaml <br />
                   Created by Andy Bavier, andy@opennetworking.org <br />
-                  Copyright (c) 2019 Open Networking Foundation (ONF)
+                  Copyright 2019-2023 Open Networking Foundation (ONF) and the ONF Contributors
     sandbox: true
     build-node: 'tucson-pod'
     config-pod: 'tucson-pod'
diff --git a/vars/getVolthaCode.groovy b/vars/getVolthaCode.groovy
index d763429..d7cb445 100644
--- a/vars/getVolthaCode.groovy
+++ b/vars/getVolthaCode.groovy
@@ -1,109 +1,168 @@
+#!/usr/bin/env groovy
+// -----------------------------------------------------------------------
+// -----------------------------------------------------------------------
+
+// -----------------------------------------------------------------------
+// -----------------------------------------------------------------------
+def getIam(String func)
+{
+    String src = 'vars/getVolthaCode.groovy'
+    String iam = [src, func].join('::')
+    return iam
+}
+
 // TODO the 3 stages are very similar, most of the code can be shared
 
-def call(Map config) {
+def wrapped(Map config)
+{
+    def defaultConfig = [
+	branch: "master",
+	gerritProject: "",
+	gerritRefspec: "",
+	volthaSystemTestsChange: "",
+	volthaHelmChartsChange: "",
+    ]
+    
+    def cfg = defaultConfig + config
 
-  def defaultConfig = [
-    branch: "master",
-    gerritProject: "",
-    gerritRefspec: "",
-    volthaSystemTestsChange: "",
-    volthaHelmChartsChange: "",
-  ]
+    println "Downloading VOLTHA code with the following parameters: ${cfg}."
 
-  if (!config) {
-      config = [:]
-  }
+    stage('Download Patch')
+    {
+	frequent_repos = [
+	    '',
+	    'voltha-system-tests',
+	    'voltha-helm-charts',
+	]
 
-  def cfg = defaultConfig + config
+	// We are always downloading those repos, if the patch under test is in one of those
+	// just checkout the patch, no need to clone it again
+	if ( !(cfg.gerritProject in frequent_repos))
+	{
+	    repo_project = "https://gerrit.opencord.org/${cfg.gerritProject}"
+		
+	    checkout([
+		$class: 'GitSCM',
+		userRemoteConfigs: [[ url:repo_project ]],
+		branches: [[ name: "${cfg.branch}", ]],
+		extensions: [
+		    [$class: 'WipeWorkspace'],
+		    [$class: 'RelativeTargetDirectory', relativeTargetDir: "${cfg.gerritProject}"],
+		    [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
+		],
+	    ])
 
-  println "Downloading VOLTHA code with the following parameters: ${cfg}."
-
-  stage('Download Patch') {
-    // We are always downloading those repos, if the patch under test is in one of those
-    // just checkout the patch, no need to clone it again
-    if (cfg.gerritProject != 'voltha-system-tests' &&
-      cfg.gerritProject != 'voltha-helm-charts' &&
-      cfg.gerritProject != '') {
-      checkout([
-        $class: 'GitSCM',
-        userRemoteConfigs: [[
-          url: "https://gerrit.opencord.org/${cfg.gerritProject}",
-        ]],
-        branches: [[ name: "${cfg.branch}", ]],
-        extensions: [
-          [$class: 'WipeWorkspace'],
-          [$class: 'RelativeTargetDirectory', relativeTargetDir: "${cfg.gerritProject}"],
-          [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
-        ],
-      ])
-      sh """
+	    sh """
         pushd $WORKSPACE/${cfg.gerritProject}
+        git fetch "$repo_project" ${cfg.gerritRefspec} && git checkout FETCH_HEAD
+
+        echo "Currently on commit: \n"
+        git log -1 --oneline
+        popd
+      """
+	}
+    }
+
+    stage('Clone voltha-system-tests')
+    {	
+	repo_vst = 'https://gerrit.opencord.org/voltha-system-tests'
+
+	checkout([
+	    $class: 'GitSCM',
+	    userRemoteConfigs: [[ url:repo_url ]],
+	    branches: [[ name: "${cfg.branch}", ]],
+	    extensions: [
+		[$class: 'WipeWorkspace'],
+		[$class: 'RelativeTargetDirectory', relativeTargetDir: "voltha-system-tests"],
+		[$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
+	    ],
+	])
+
+	if (cfg.volthaSystemTestsChange != '' && cfg.gerritProject != 'voltha-system-tests')
+	{
+	    sh """
+        cd "$WORKSPACE/voltha-system-tests"
+        git fetch "${repo_vst}" ${cfg.volthaSystemTestsChange} && git checkout FETCH_HEAD
+      """
+	}
+	else if (cfg.gerritProject == 'voltha-system-tests') {
+	    sh """
+        pushd "$WORKSPACE/${cfg.gerritProject}"
         git fetch https://gerrit.opencord.org/${cfg.gerritProject} ${cfg.gerritRefspec} && git checkout FETCH_HEAD
 
         echo "Currently on commit: \n"
         git log -1 --oneline
         popd
       """
+	}
     }
-  }
-  stage('Clone voltha-system-tests') {
-    checkout([
-      $class: 'GitSCM',
-      userRemoteConfigs: [[
-        url: "https://gerrit.opencord.org/voltha-system-tests",
-      ]],
-      branches: [[ name: "${cfg.branch}", ]],
-      extensions: [
-        [$class: 'WipeWorkspace'],
-        [$class: 'RelativeTargetDirectory', relativeTargetDir: "voltha-system-tests"],
-        [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
-      ],
-    ])
-    if (cfg.volthaSystemTestsChange != '' && cfg.gerritProject != 'voltha-system-tests') {
-      sh """
-        cd $WORKSPACE/voltha-system-tests
-        git fetch https://gerrit.opencord.org/voltha-system-tests ${cfg.volthaSystemTestsChange} && git checkout FETCH_HEAD
+
+    stage('Clone voltha-helm-charts')
+    {
+	repo_vhc = 'https://gerrit.opencord.org/voltha-helm-charts'
+
+	checkout([
+	    $class: 'GitSCM',
+	    userRemoteConfigs: [[ url:repo_vhc ]],
+	    branches: [[ name: "${cfg.branch}", ]],
+	    extensions: [
+		[$class: 'WipeWorkspace'],
+		[$class: 'RelativeTargetDirectory', relativeTargetDir: "voltha-helm-charts"],
+		[$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
+	    ],
+	])
+
+	if (cfg.volthaHelmChartsChange != '' && cfg.gerritProject != 'voltha-helm-charts') {
+	    sh """
+        cd "$WORKSPACE/voltha-helm-charts"
+        git fetch "$repo_vhc" ${cfg.volthaHelmChartsChange} && git checkout FETCH_HEAD
       """
-    }
-    else if (cfg.gerritProject == 'voltha-system-tests') {
-      sh """
-        pushd $WORKSPACE/${cfg.gerritProject}
-        git fetch https://gerrit.opencord.org/${cfg.gerritProject} ${cfg.gerritRefspec} && git checkout FETCH_HEAD
+	}
+	else if (cfg.gerritProject == 'voltha-helm-charts') {
+	    sh """
+        pushd "$WORKSPACE/${cfg.gerritProject}"
+        git fetch "https://gerrit.opencord.org/${cfg.gerritProject}" ${cfg.gerritRefspec} && git checkout FETCH_HEAD
 
         echo "Currently on commit: \n"
         git log -1 --oneline
         popd
       """
+	}
     }
-  }
-  stage('Clone voltha-helm-charts') {
-    checkout([
-      $class: 'GitSCM',
-      userRemoteConfigs: [[
-        url: "https://gerrit.opencord.org/voltha-helm-charts",
-      ]],
-      branches: [[ name: "${cfg.branch}", ]],
-      extensions: [
-        [$class: 'WipeWorkspace'],
-        [$class: 'RelativeTargetDirectory', relativeTargetDir: "voltha-helm-charts"],
-        [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
-      ],
-    ])
-    if (cfg.volthaHelmChartsChange != '' && cfg.gerritProject != 'voltha-helm-charts') {
-      sh """
-        cd $WORKSPACE/voltha-helm-charts
-        git fetch https://gerrit.opencord.org/voltha-helm-charts ${cfg.volthaHelmChartsChange} && git checkout FETCH_HEAD
-      """
-    }
-    else if (cfg.gerritProject == 'voltha-helm-charts') {
-      sh """
-        pushd $WORKSPACE/${cfg.gerritProject}
-        git fetch https://gerrit.opencord.org/${cfg.gerritProject} ${cfg.gerritRefspec} && git checkout FETCH_HEAD
+}
 
-        echo "Currently on commit: \n"
-        git log -1 --oneline
-        popd
-      """
+// -----------------------------------------------------------------------
+// -----------------------------------------------------------------------
+def call(Map config)
+{
+    String iam = getIam('main')
+    Boolean debug = false
+
+    if (debug)
+    {
+	println("** ${iam}: ENTER")
     }
-  }
+
+    if (!config) {
+        config = [:]
+    }
+
+    try
+    {
+	wrapped(config)
+    }
+    catch (Exception err)
+    {
+	println("** ${iam}: EXCEPTION ${err}")
+	throw err
+    }
+    finally
+    {
+	if (debug)
+	{
+	    println("** ${iam}: LEAVE")
+	}
+    }
+
+    return
 }