Merge "[VOL-4939] - Disable lingering scale jobs on branch=2.11"
diff --git a/jjb/pipeline/voltha/playground/physical-build.groovy b/jjb/pipeline/voltha/playground/physical-build.groovy
index 5779ac1..856006e 100644
--- a/jjb/pipeline/voltha/playground/physical-build.groovy
+++ b/jjb/pipeline/voltha/playground/physical-build.groovy
@@ -33,13 +33,32 @@
 // -----------------------------------------------------------------------
 def getIam(String func)
 {
+    /*
+     [TODO]
+     -----------------------------------------------------------------------
+     java stack trace is hosed due to jenkins internal meddeling to support
+     serializable.  Lets see if groovy Throwable wrapper can produce a
+     better answer.
+     -----------------------------------------------------------------------
+
+    try
+    {
+        throw new Exception('Generating a stacktrace')
+    }
+    catch (Throwable err)
+    {
+        // https://docs.groovy-lang.org/2.4.7/html/api/org/codehaus/groovy/GroovyException.html
+        err.printStackTrace()
+        stack = err.getStackTrace()
+    }
+
     // Cannot rely on a stack trace due to jenkins manipulation
     String src = [
         'jjb',
         'pipeline',
         'voltha',
         'playground',
-        'voltha-tt-physical-functional-tests.groovy'
+        'physical-build.groovy'
     ].join('/')
 
     String iam = [src, func].join('::')
@@ -78,24 +97,25 @@
     {
         stage('Download Code')
         {
-            iam(this)
+            steps
             {
-                enter = true
-                label = getIam()
-            }
+                iam(this)
+                {
+                    enter = true
+                    label = getIam()
+                }
 
-            steps {
                 getVolthaCode([
                     branch: "${branch}",
                     volthaSystemTestsChange: "${volthaSystemTestsChange}",
                     volthaHelmChartsChange: "${volthaHelmChartsChange}",
                 ])
-            }
 
-            iam(this)
-            {
-                leave = true
-                label = getIam()
+                iam(this)
+                {
+                    leave = true
+                    label = getIam()
+                }
             }
         }
 
diff --git a/jjb/pipeline/voltha/playground/voltha-tt-physical-functional-tests.groovy b/jjb/pipeline/voltha/playground/voltha-tt-physical-functional-tests.groovy
index f0965ff..39e543f 100644
--- a/jjb/pipeline/voltha/playground/voltha-tt-physical-functional-tests.groovy
+++ b/jjb/pipeline/voltha/playground/voltha-tt-physical-functional-tests.groovy
@@ -73,14 +73,14 @@
         // -----------------------------------------------------------------------
         stage('Clone voltha-system-tests')
         {
+            iam(this)
+            {
+                enter = true
+                label = getIam()
+            }
+
             steps
             {
-                iam(this)
-                {
-                    enter = true
-                    label = getIam()
-                }
-
                 step([$class: 'WsCleanup'])
                 checkout([
                     $class: 'GitSCM',
@@ -109,13 +109,13 @@
               exit 1  # verify fail
             fi
             """)
+                } // step
 
                 iam(this)
                 {
                     leave = true
                     label = getIam()
                 }
-                } // step
             } // steps
         } // stage
 
diff --git a/jjb/voltha-test/voltha.yaml b/jjb/voltha-test/voltha.yaml
index 95e33b1..272eb07 100644
--- a/jjb/voltha-test/voltha.yaml
+++ b/jjb/voltha-test/voltha.yaml
@@ -79,9 +79,9 @@
           test-repo: 'voltha-system-tests'
           profile: 'Default'
 
-      # flex OCP pod with olt/onu - 1T4GEM tech profile and timer based job
+      # [VOL-4939] - flex OCP pod with olt/onu - 1T4GEM tech profile and timer based job
       - 'build_voltha_pod_release_timer':
-          disable-job: false
+          disable-job: true
           build-node: 'qa-testvm-pod'
           config-pod: 'flex-ocp-cord'
           release: '2.11'
@@ -93,7 +93,7 @@
           num-of-atomix: '3'
           pipeline-script: 'voltha/voltha-2.11/physical-build.groovy'
 
-      # flex OCP pod with olt/onu - 1T4GEM tech profile and timer based job
+      # [VOL-4939] - flex OCP pod with olt/onu - 1T4GEM tech profile and timer based job
       - 'build_voltha_pod_release_timer':
           disable-job: true
           build-node: 'qa-testvm-pod'
@@ -118,9 +118,9 @@
           test-repo: 'voltha-system-tests'
           profile: '1T4GEM'
 
-      # flex pod1 test job - released versions: uses tech profile on voltha branch
+      # [VOL-4939] - flex pod1 test job - released versions: uses tech profile on voltha branch
       - 'build_voltha_pod_test':
-          disable-job: false
+          disable-job: true
           build-node: 'qa-testvm-pod'
           config-pod: 'flex-ocp-cord'
           release: '2.11'
@@ -176,9 +176,9 @@
           num-of-atomix: '3'
           pipeline-script: 'voltha/voltha-2.8/physical-build.groovy'
 
-      # flex OCP pod with olt/onu - Released versions Default tech profile and timer based job
+      # [VOL-4939] - flex OCP pod with olt/onu - Released versions Default tech profile and timer based job
       - 'build_voltha_pod_release_timer':
-          disable-job: false
+          disable-job: true
           build-node: 'qa-testvm-pod'
           config-pod: 'flex-ocp-cord'
           release: '2.11'
@@ -206,9 +206,9 @@
           test-repo: 'voltha-system-tests'
           profile: 'TP'
 
-      # flex pod1 test job - released versions: uses tech profile on voltha branch
+      # [VOL-4939] - flex pod1 test job - released versions: uses tech profile on voltha branch
       - 'build_voltha_pod_test':
-          disable-job: false
+          disable-job: true
           build-node: 'qa-testvm-pod'
           config-pod: 'flex-ocp-cord'
           release: '2.11'
diff --git a/vars/iam.groovy b/vars/iam.groovy
index 75f204d..cafd8f2 100644
--- a/vars/iam.groovy
+++ b/vars/iam.groovy
@@ -110,9 +110,18 @@
 //         tans = fans
 //     }
 // -----------------------------------------------------------------------
-Boolean call(def self, Map argv)
+Boolean call\
+    (
+    def body,  // jenkins closure attached to the call iam() {closure}
+    def self,  // jenkins env object for access to primitives like echo()
+    )
 {
-    argv = argv ?: [:] // {ternary,elvis} operator
+    // evaluate the body block and collect configuration into the object
+    Map argv = [:] // {ternary,elvis} operator
+    body.resolveStrategy = Closure.DELEGATE_FIRST
+    body.delegate = config
+    body()
+
     String iam = getIam(argv, 'main')
 
     println("** ${iam}: argv=${argv}")
@@ -123,6 +132,7 @@
         // [WIP] type(self) needed to quiet lint complaint.
         // npm-groovy-lint:  def for method parameter type should not be used  NoDef
         print(" ** $iam: Type of self variable is =" + self.getClass())
+        print(" ** $iam: Type of body variable is =" + body.getClass())
         // if (! self instanceof jenkins_object) { throw }
 
         if (process(argv))
@@ -150,5 +160,11 @@
     return(true)
 }
 
-// [EOF]
+/*
+ * -----------------------------------------------------------------------
+[SEE ALSO]
+  o https://rtyler.github.io/jenkins.io/doc/book/pipeline/shared-libraries/#defining-a-more-structured-dsl
+ * -----------------------------------------------------------------------
+ */
 
+// [EOF]