[CORD-3050]v2
Update helmlint.sh to match Jenkins
Have candidate-tag-values.yaml set imagePullPolicy to IfNotPresent

Change-Id: I5eecef41f28d528ab0c0499a977695b4c7207932
diff --git a/examples/candidate-tag-values.yaml b/examples/candidate-tag-values.yaml
index 523d307..68d0d86 100644
--- a/examples/candidate-tag-values.yaml
+++ b/examples/candidate-tag-values.yaml
@@ -14,6 +14,10 @@
 # limitations under the License.
 
 # Set all image tags to "candidate" to use imagebuilder's local images
+# Also set imagePullPolicy to IfNotPresent, so these images will be used.
+
+# in xos-core, rcord-lite, onos and voltha charts
+imagePullPolicy: 'IfNotPresent'
 
 # in xos-core chart
 xos_coreImage: 'xosproject/xos-core:candidate'
@@ -25,6 +29,7 @@
 xos-gui:
   xos_guiImage: 'xosproject/xos-gui:candidate'
   xos_wsImage: 'xosproject/xos-ws:candidate'
+  imagePullPolicy: 'IfNotPresent'
 
 # in rcord-lite chart
 rcord_synchronizerImage: "xosproject/rcord-synchronizer:candidate"
@@ -32,17 +37,26 @@
 # in service charts
 addressmanager:
   addressmanager_synchronizerImage: "xosproject/addressmanager-synchronizer:candidate"
+  imagePullPolicy: 'IfNotPresent'
 fabric:
   fabric_synchronizerImage: "xosproject/fabric-synchronizer:candidate"
+  imagePullPolicy: 'IfNotPresent'
 onos-service:
   onos_synchronizerImage: "xosproject/onos-synchronizer:candidate"
+  imagePullPolicy: 'IfNotPresent'
 volt:
   volt_synchronizerImage: "xosproject/volt-synchronizer:candidate"
+  imagePullPolicy: 'IfNotPresent'
 vsg-hw:
   vsg_hw_synchronizerImage: "xosproject/vsg-hw-synchronizer:candidate"
+  imagePullPolicy: 'IfNotPresent'
 vrouter:
   vrouter_synchronizerImage: "xosproject/vrouter-synchronizer:candidate"
+  imagePullPolicy: 'IfNotPresent'
 kubernetes:
   kubernetes_synchronizerImage: "xosproject/kubernetes-synchronizer:candidate"
+  imagePullPolicy: 'IfNotPresent'
 simpleexampleservice:
   simpleexampleservice_synchronizerImage: "xosproject/simpleexampleservice-synchronizer:candidate"
+  imagePullPolicy: 'IfNotPresent'
+
diff --git a/examples/if-not-present-values.yaml b/examples/if-not-present-values.yaml
index bb2a619..5c473bf 100644
--- a/examples/if-not-present-values.yaml
+++ b/examples/if-not-present-values.yaml
@@ -1,5 +1,4 @@
 ---
-
 # Copyright 2018-present Open Networking Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,7 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-# Set all image tags to "candidate" to use imagebuilder's local images
+# Only pull docker images if not already present
 
 # in xos-core, rcord-lite, onos and voltha charts
 imagePullPolicy: 'IfNotPresent'
diff --git a/scripts/helmlint.sh b/scripts/helmlint.sh
index 0fe48c0..27cf676 100755
--- a/scripts/helmlint.sh
+++ b/scripts/helmlint.sh
@@ -17,17 +17,24 @@
 # helmlint.sh
 # run `helm lint` on all helm charts that are found
 
-set +e
+set +e -u -o pipefail
+
+# verify that we have helm installed
+command -v helm >/dev/null 2>&1 || { echo "helm not found, please install it" >&2; exit 1; }
+
 echo "helmlint.sh, using helm version: $(helm version -c --short)"
 
 fail_lint=0
 
-for chart in $(find . -name Chart.yaml -print) ; do
+# when not running under Jenkins, use current dir as workspace
+WORKSPACE=${WORKSPACE:-.}
+
+for chart in $(find "${WORKSPACE}" -name Chart.yaml -print) ; do
 
   chartdir=$(dirname "${chart}")
 
   # update requirements if it exists. Skip voltha as it has non-clean reqirements
-  if [ "${chartdir}" != "./voltha" ] && [ -f "${chartdir}/requirements.yaml" ]; then
+  if [[ ! $chartdir =~ voltha$ ]] && [ -f "${chartdir}/requirements.yaml" ]; then
     helm dependency update "${chartdir}"
   fi