Separate VPP stacktrace generation from artifact archiving 78/32078/2
authorDave Wallace <dwallacelf@gmail.com>
Wed, 21 Apr 2021 16:52:51 +0000 (12:52 -0400)
committerDave Wallace <dwallacelf@gmail.com>
Fri, 23 Apr 2021 17:56:46 +0000 (13:56 -0400)
- Separate removal of socket files in workspace archive directory
  from archiving of artifacts
- Clean up deprecated workspace-archive-artifacts-parameter macro

Change-Id: I11c7fe55d3412fb7261da9f0cfb809a152ae1d51
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
jjb/global-macros.yaml
jjb/hicn/hicn.yaml
jjb/scripts/post_build_deploy_archives.sh
jjb/vpp/vpp.yaml

index 42ed907..efa1e17 100644 (file)
           name: TOPO
           default: '{topo}'
           description: "Topology parameter"
-
-- parameter:
-    name: workspace-archive-artifacts-parameter
-    parameters:
-      - string:
-          name: WS_ARCHIVE_ARTIFACTS
-          default: '{artifacts}'
-          description: "Artifacts to archive in $WORKSPACE/archives."
 # [end] Keep 'parameter' entries ordered alphabetically, please.
 
 #### SCMS
index c3bc910..93d3b9d 100644 (file)
           os: "{os}"
       - repo-name-parameter:
           repo-name: "{repo-stream-part}.ubuntu.bionic.main"
-      - workspace-archive-artifacts-parameter:
+      - archive-artifacts-parameter:
           artifacts: '{archive-artifacts}'
 
     scm:
           repo-name: "{repo-stream-part}.{repo-os-part}"
       - stream-parameter:
           stream: "{stream}"
-      - workspace-archive-artifacts-parameter:
+      - archive-artifacts-parameter:
           artifacts: '{archive-artifacts}'
 
     scm:
           stream: "{repository-name}"
       - repo-name-parameter:
           repo-name: "{repo-stream-part}.{repo-os-part}"
-      - workspace-archive-artifacts-parameter:
+      - archive-artifacts-parameter:
           artifacts: '{archive-artifacts}'
 
     scm:
           repo-name: "{repo-stream-part}.{repo-os-part}"
       - stream-parameter:
           stream: "{stream}"
-      - workspace-archive-artifacts-parameter:
+      - archive-artifacts-parameter:
           artifacts: '{archive-artifacts}'
 
     scm:
           stream: "hicn"
       - repo-name-parameter:
           repo-name: "{repo-stream-part}.{repo-os-part}"
-      - workspace-archive-artifacts-parameter:
+      - archive-artifacts-parameter:
           artifacts: '{archive-artifacts}'
 
     scm:
index 79fa05a..355d6fd 100755 (executable)
@@ -48,6 +48,9 @@ STACKTRACE=""
 # Returns stacktrace filename in STACKTRACE
 generate_vpp_stacktrace_and_delete_core() {
     local corefile="$1"
+    echo "Uncompressing core file $file"
+    gunzip "$corefile"
+    corefile="${corefile::(-3)}"
     if grep -qe 'debug' <<< "$WORKSPACE" ; then
         local binfile="$WORKSPACE/build-root/install-vpp_debug-native/vpp/bin/vpp"
     else
@@ -61,8 +64,9 @@ generate_vpp_stacktrace_and_delete_core() {
     echo "Removing core file: $corefile"
     rm -f "$corefile"
     # Dump stacktrace to console log
-    if [ -f $STACKTRACE ] ; then
+    if [ -f "$STACKTRACE" ] ; then
         echo -e "\n=====[ $STACKTRACE ]=====\n$(cat $STACKTRACE)\n=====[ $STACKTRACE ]=====\n"
+        gzip "$STACKTRACE"
     else
         echo "Stacktrace file not generated!"
         STACKTRACE=""
@@ -77,30 +81,12 @@ env > $BUILD_ENV_LOG
 
 echo "ARCHIVE_ARTIFACTS = '$ARCHIVE_ARTIFACTS'"
 if [ -n "${ARCHIVE_ARTIFACTS:-}" ] ; then
-    pushd $WORKSPACE
+    pushd "$WORKSPACE"
     shopt -s globstar  # Enable globstar to copy archives
     for file in $ARCHIVE_ARTIFACTS ; do
         if [ -f "$file" ] ; then
-            fname="$(basename $file)"
-            # Decompress core.gz file
-            if grep -qe '^core.*\.gz$' <<<"$fname" ; then
-                echo "Uncompressing core file $file"
-                gunzip "$file"
-                file="${file::(-3)}"
-            fi
-            # Convert core file to stacktrace
-            if [ "${fname::4}" = "core" ] ; then
-                generate_vpp_stacktrace_and_delete_core $file
-                [ -z "$STACKTRACE" ] && continue
-                file=$STACKTRACE
-            fi
-            # Set destination filename
-            if [ "${file::26}" = "/tmp/vpp-failed-unittests/" ] ; then
-                destfile=$WS_ARCHIVES_DIR${file:25}
-            else
-                destfile=$WS_ARCHIVE_DIR$file
-            fi
             echo "Archiving '$file' to '$destfile'"
+            destfile="$WS_ARCHIVE_DIR$file"
             destdir="$(dirname $destfile)"
             mkdir -p $destdir
             mv -f $file $destfile
@@ -122,5 +108,15 @@ find $WS_ARCHIVES_DIR -type f -print0 \
                 | cut -d: -f1 \
                 | xargs -d'\n' -r gzip
 
+# generate stack trace for VPP core files for upload instead of core file.
+if [ -d "$WORKSPACE/build-root" ] ; then
+    for file in $(find $WS_ARCHIVES_DIR -type f -name 'core*.gz') ; do
+        generate_vpp_stacktrace_and_delete_core $file
+    done
+fi
+
+# Remove any socket files in archive
+find $WS_ARCHIVES_DIR -type s -exec rm -rf {} \;
+
 echo "Workspace archived artifacts:"
 ls -alR $WS_ARCHIVES_DIR
index 2f015d4..ccd636b 100644 (file)
@@ -70,7 +70,6 @@
     project: 'vpp'
     make-parallel-jobs: '4'
     make-test-os: 'ubuntu-20.04'
-    archive-artifacts: '/tmp/vpp-failed-unittests/*/*'
     stream:
       - master:
           branch: 'master'
     project: 'vpp'
     make-parallel-jobs: '4'
     make-test-os: 'ubuntu-20.04'
-    archive-artifacts: '/tmp/vpp-failed-unittests/*/*'
     comment-trigger-value: 'debug-verify'
     stream:
       - master:
     project: 'vpp'
     make-parallel-jobs: '16'
     make-test-os: 'ubuntu-20.04'
-    archive-artifacts: '/tmp/vpp-failed-unittests/*/*'
     stream:
       - master:
           branch: 'master'
 
     # Please keep parameters in alphabetical order
     parameters:
+      - archive-artifacts-parameter:
+          artifacts: '{archive-artifacts}'
       - gerrit-parameter:
           branch: '{branch}'
       - gerrit-refspec-parameter:
           project: '{project}'
       - repo-name-parameter:
           repo-name: '{repo-stream-part}.ubuntu.bionic.main'
-      - workspace-archive-artifacts-parameter:
-          artifacts: '{archive-artifacts}'
 
     scm:
       - gerrit-trigger-scm:
 
     # Please keep parameters in alphabetical order
     parameters:
+      - archive-artifacts-parameter:
+          artifacts: '{archive-artifacts}'
       - gerrit-parameter:
           branch: '{branch}'
       - gerrit-refspec-parameter:
           repo-name: '{repo-stream-part}.{repo-os-part}'
       - stream-parameter:
           stream: '{stream}'
-      - workspace-archive-artifacts-parameter:
-          artifacts: '{archive-artifacts}'
 
     scm:
       - gerrit-trigger-scm:
 
     # Please keep parameters in alphabetical order
     parameters:
+      - archive-artifacts-parameter:
+          artifacts: '{archive-artifacts}'
       - gerrit-parameter:
           branch: '{branch}'
       - gerrit-refspec-parameter:
           repo-name: '{repo-stream-part}.ubuntu.bionic.main'
       - stream-parameter:
           stream: '{stream}'
-      - workspace-archive-artifacts-parameter:
-          artifacts: '{archive-artifacts}'
 
     scm:
       - gerrit-trigger-scm:
           repo-name: '{repo-stream-part}.{repo-os-part}'
       - stream-parameter:
           stream: '{stream}'
-      - workspace-archive-artifacts-parameter:
+      - archive-artifacts-parameter:
           artifacts: '{archive-artifacts}'
 
     scm:
           repo-name: '{repo-stream-part}.{repo-os-part}'
       - stream-parameter:
           stream: '{stream}'
-      - workspace-archive-artifacts-parameter:
+      - archive-artifacts-parameter:
           artifacts: '{archive-artifacts}'
 
     scm: