[VOL-5180] - installVolthaStack: enhance polling loop

vars/volthaStackDeploy.groovy
-----------------------------
  o Add more cluster state detection for Error.
  o Fail hard and noisy when detected.

Change-Id: I76328ba670653dde802f6152f37a1f19c5e357b4
diff --git a/jjb/voltha-e2e/voltha-2.8.yaml b/jjb/voltha-e2e/voltha-2.8.yaml
index 994a79d..912e530 100644
--- a/jjb/voltha-e2e/voltha-2.8.yaml
+++ b/jjb/voltha-e2e/voltha-2.8.yaml
@@ -30,7 +30,7 @@
           code-branch: 'voltha-2.8'
           extraHelmFlags: '--set kafka.externalAccess.enabled=true,kafka.externalAccess.service.type=NodePort,kafka.externalAccess.service.nodePorts[0]=30201,kafka.externalAccess.service.domain=127.0.0.1'
           time-trigger: "H H/23 * * *"
-          logLevel: 'DEBUG'
+          logLevel: 'INFO'
           testTargets: |
             - target: voltha-pm-data-single-kind-att
               workflow: att
diff --git a/vars/volthaStackDeploy.groovy b/vars/volthaStackDeploy.groovy
index 452fb7d..9b198e5 100644
--- a/vars/volthaStackDeploy.groovy
+++ b/vars/volthaStackDeploy.groovy
@@ -140,6 +140,7 @@
 vsd_log='volthaStackDeploy.tmp'
 touch \$vsd_log
 
+declare -i rc=0          # exit status
 while true; do
 
     # Gather
@@ -164,12 +165,25 @@
     if grep -q -e 'ContainerCreating' \$vsd_log; then
         echo -e '\nvolthaStackDeploy.groovy: ContainerCrating active'
         [[ -v debug ]] && grep -e 'ContainerCreating' \$vsd_log
+
     elif grep -q -e '0/' \$vsd_log; then
         echo -e '\nvolthaStackDeploy.groovy: Waiting for status=Running'
         [[ -v debug ]] && grep -e '0/' \$vsd_log
+
     elif ! grep -q '/' \$vsd_log; then
         echo -e '\nvolthaStackDeploy.groovy: Waiting for initial pod activity'
         [[ ! -v verbose ]] && { cat \$vsd_log; }
+
+    # -----------------------------------------------------------------------
+    # voltha-adapter-openolt-68c84bf786-8xsfc   0/1   CrashLoopBackOff 2 69s
+    # voltha-adapter-openolt-68c84bf786-8xsfc   0/1   Error            3 85s
+    # -----------------------------------------------------------------------
+    elif grep -q 'Error' \$vsd_log; then
+        echo -e '\nvolthaStackDeploy.groovy: Detected cluster state=Error'
+        cat \$vsd_log
+        rc=1 # fatal
+        break
+
     # -----------------------------------------------------------------------
     # An extra conditon needed here but shell coding is tricky:
     #    "svc x/y Running 0 6s
@@ -187,6 +201,7 @@
 
 done
 rm -f \$vsd_log
+exit \$rc
 """)
 
     leave('launchVolthaStack')