VOL-4925 - Build and release components.

jjb/shell/github-release.sh
---------------------------
  o Added a display banner to identify running script and version.
    Recent change to use cp -vs- rsync for release/* copy is not
    visible in the job log -- timing issue ?
  o Source common lib stacktrace.sh and traputils.sh to be more
    verbose when the script edits (courtesy of set -e).
  o Debugging statements added.
  o Use stacktrace.sh to display callstack when script exits with error.

jjb/shell/common/README.md
jjb/shell/common/common.sh
jjb/shell/common/example.sh
jjb/shell/common/preserve_argv.sh
jjb/shell/common/common/sh/tempdir.sh
jjb/shell/common/common/sh/traputils.sh
jjb/shell/common/common/sh/stacktrace.sh
-----------------------------------------
  o Create a common library of reusable utility shell scripts.
  o tempdir.sh    - automatic creation and removal of mktempdir()
  o stacktrace.sh - display script call stack.
  o traputils.sh  - register an interrupt handler calling stacktrace on exit.

Change-Id: I563948f078cf33fef4a58be2b7455f07a3bd9e3a
diff --git a/jjb/shell/github-release.sh b/jjb/shell/github-release.sh
index 8ff8754..32fa72b 100644
--- a/jjb/shell/github-release.sh
+++ b/jjb/shell/github-release.sh
@@ -20,6 +20,54 @@
 # message
 # -----------------------------------------------------------------------
 
+##-------------------##
+##---]  GLOBALS  [---##
+##-------------------##
+declare -g SCRIPT_VERSION='1.0' # git changeset needed
+declare -g TRACE=1              # uncomment to set -x
+declare -g ARGV="$*"            # archive for display
+
+##--------------------##
+##---]  INCLUDES  [---##
+##--------------------##
+declare -g pgmdir="${0%/*}" # dirname($script)
+declare -a common_args=()
+common_args+=('--common-args-begin--')
+common_args+=('--traputils')
+common_args+=('--stacktrace')
+# common_args+=('--tempdir')
+
+# shellcheck disable=SC1091
+source "${pgmdir}/common/common.sh" "${common_args[@]}"
+
+## -----------------------------------------------------------------------
+## Intent: Output a log banner to identify the running script/version.
+## -----------------------------------------------------------------------
+## TODO:
+##   o SCRIPT_VERSION => git changeset for repo:ci-managment
+##   o echo "library version: ${env."library.libName.version"}"
+# -----------------------------------------------------------------------
+# 14:18:38   > git fetch --no-tags --progress -- https://gerrit.opencord.org/ci-management.git +refs/heads/*:refs/remotes/origin/* # timeout=10
+# 14:18:39  Checking out Revision 50f6e0b97f449b32d32ec0e02d59642000351847 (master)
+# -----------------------------------------------------------------------
+function banner()
+{
+    local iam="${0##*/}"
+
+cat <<EOH
+
+** -----------------------------------------------------------------------
+** IAM: ${iam} :: ${FUNCNAME[0]}
+** ARGV: ${ARGV}
+** PWD: $(/bin/pwd)
+** NOW: $(date '+%Y/%m/%d %H:%M:%S')
+** VER: ${SCRIPT_VERSION:-'unknown'}
+** -----------------------------------------------------------------------
+EOH
+
+    return
+}
+
 ## -----------------------------------------------------------------------
 ## Intent:
 ##   Display available command versions
@@ -56,7 +104,9 @@
 
     # Copy artifacts into the release temp dir
     # shellcheck disable=SC2086
-    cp -v "$ARTIFACT_GLOB" "$RELEASE_TEMP"
+    # cp -v "$ARTIFACT_GLOB" "$RELEASE_TEMP"
+    echo "rsync -rv --checksum \"$ARTIFACT_GLOB\" \"$RELEASE_TEMP/.\""
+    rsync -rv --checksum "$ARTIFACT_GLOB" "$RELEASE_TEMP/."
     
     echo
     echo "** ${FUNCNAME[0]}: RELEASE_TEMP=${RELEASE_TEMP}"
@@ -72,6 +122,8 @@
 ##----------------##
 set -eu -o pipefail
 
+banner
+
 # when not running under Jenkins, use current dir as workspace and a blank
 # project name
 WORKSPACE=${WORKSPACE:-.}
@@ -82,7 +134,7 @@
 GITHUB_ORGANIZATION=${GITHUB_ORGANIZATION:-}
 
 # glob pattern relative to project dir matching release artifacts
-# ARTIFACT_GLOB=${ARTIFACT_GLOB:-"release/*"}
+# ARTIFACT_GLOB=${ARTIFACT_GLOB:-"release/*"} # stat -- release/* not found, literal string (?)
 ARTIFACT_GLOB=${ARTIFACT_GLOB:-"release/."}
 
 # Temporary staging directory to copy artifacts to
@@ -133,6 +185,11 @@
   exit 1
 else
 
+  declare -p release_path
+
+  # shellcheck disable=SC2015
+  [[ -v TRACE ]] && { set -x; } || { set +x; } # SC2015 (shellcheck -x)
+
   pushd "$release_path"
 
   # Release description is sanitized version of the log message
@@ -146,11 +203,11 @@
 
   # Are we failing on a literal string "release/*" ?
   # cp -v "$ARTIFACT_GLOB" "$RELEASE_TEMP"
-  echo "rsync -rv --checksum \"$ARTIFACT_GLOB\" \"$RELEASE_TEMP/.\""
-  rsync -rv --checksum "$ARTIFACT_GLOB" "$RELEASE_TEMP/."
+  # echo "rsync -rv --checksum \"$ARTIFACT_GLOB\" \"$RELEASE_TEMP/.\""
+  # rsync -rv --checksum "$ARTIFACT_GLOB" "$RELEASE_TEMP/."
 
   echo
-  echo "RELEASE_TEMP(${RELEASE_TMP}) contains:"
+  echo "RELEASE_TEMP(${RELEASE_TEMP}) contains:"
   find "$RELEASE_TEMP" -ls
 
   # create release