Debugging added

jjb/onos-app-release.yaml
jjb/pipeline/onos-app-release.groovy
------------------------------------
  o Add debugging to figure out why Change-Id string is missing from
    the auto-generated patch checkins.
  o Verify PWD, path to hooks directory and permissions.

Change-Id: Idbb5780370c82138240c1277bc27503bdf5864bc
diff --git a/jjb/onos-app-release.yaml b/jjb/onos-app-release.yaml
index dd22408..5247984 100644
--- a/jjb/onos-app-release.yaml
+++ b/jjb/onos-app-release.yaml
@@ -76,4 +76,4 @@
 
     dsl: !include-raw-escape: pipeline/onos-app-release.groovy
 
-# [EOF]
+# [EOF] .
diff --git a/jjb/pipeline/onos-app-release.groovy b/jjb/pipeline/onos-app-release.groovy
index 4cd3011..12e69c7 100644
--- a/jjb/pipeline/onos-app-release.groovy
+++ b/jjb/pipeline/onos-app-release.groovy
@@ -1,4 +1,4 @@
-// Copyright 2019-2023 Open Networking Foundation (ONF) and the ONF Contributors
+// Copyright 2019-2024 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.
@@ -21,6 +21,60 @@
 def branch = '${branch}'
 def jdkDistro = '${jdkDistro}'
 
+// -----------------------------------------------------------------------
+// Intent: Identify running script.  callstack() cannot be used here,
+//   jenkins + serialization alters stack trace making display unreliable.
+// -----------------------------------------------------------------------
+String getIam(String func) {
+    // Cannot rely on a stack trace due to jenkins manipulation
+    String src = 'jjb/pipeline/onos-app-release.groovy'
+    String iam = [src, func].join('::')
+    return iam
+}
+
+// -----------------------------------------------------------------------
+// Intent: Log progress message
+// -----------------------------------------------------------------------
+void enter(String name) {
+    // Announce ourselves for log usability
+    String iam = getIam(name)
+    println("${iam}: ENTER")
+    return
+}
+
+// -----------------------------------------------------------------------
+// Intent: Log progress message
+// -----------------------------------------------------------------------
+void leave(String name) {
+    // Announce ourselves for log usability
+    String iam = getIam(name)
+    println("${iam}: LEAVE")
+    return
+}
+
+// -----------------------------------------------------------------------
+// https://jenkins.opencord.org/job/onos-app-release/285/consoleFull
+// -----------------------------------------------------------------------
+void git_debug(String name) {
+    enter(name)
+
+    println('''
+
+** -----------------------------------------------------------------------
+** git debugging: Commit-Id string MIA
+** -----------------------------------------------------------------------
+''')
+
+    sh 'echo "PWD: $(/bin/pwd)"'
+    sh '/bin/ls -l'
+    sh 'gitdir=$(git rev-parse --git-dir) && /bin/ls -ld ${gitdir}'
+    sh 'gitdir=$(git rev-parse --git-dir) && /bin/ls -ld ${gitdir}/hooks/'
+
+    leave(name)
+
+    return
+}
+
 // This pipeline updates the <version> tag in the root pom.xml for the
 // given app repo, and pushes two new Gerrit changes:
 //   1) With version the given ${version} (e.g., 1.0.0)
@@ -78,7 +132,7 @@
     sshagent (credentials: ['gerrit-jenkins-user']) {
       git branch: branch, url: 'ssh://jenkins@gerrit.opencord.org:29418/' + appRepo, credentialsId: 'gerrit-jenkins-user'
 
-      sh 'gitdir=$(git rev-parse --git-dir); scp -p -P 29418 jenkins@gerrit.opencord.org:hooks/commit-msg ${gitdir}/hooks/'
+      sh 'gitdir=$(git rev-parse --git-dir) && scp -p -P 29418 jenkins@gerrit.opencord.org:hooks/commit-msg ${gitdir}/hooks/'
     }
   }
 
@@ -93,6 +147,9 @@
        sh 'echo releasing api version' + '"' + apiVersion +'"'
        changeApiVersion(appName, apiVersion)
     }
+
+        git_debug("Move to release version")
+
     sh 'git add -A && git commit -m "Release app version ' + version + ' with API version ' + apiVersion + '"'
   }
 
@@ -126,6 +183,9 @@
        sh 'echo moving to next api version' + '"' + nextApiVersion +'"'
        changeApiVersion(appName, apiSnapshot)
     }
+
+        git_debug("Move to next SNAPSHOT version")
+
     sh 'git add -A && git commit -m "Starting snapshot ' + snapshot + ' with API version ' + apiSnapshot + '"'
     sshagent (credentials: ['gerrit-jenkins-user']) {
       sh 'git push origin HEAD:refs/for/' + branch