Improve archive-build to archive using globstar 82/41682/2
authorThanh Ha <thanh.ha@linuxfoundation.org>
Mon, 11 Jul 2016 20:42:11 +0000 (16:42 -0400)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Tue, 12 Jul 2016 00:12:19 +0000 (20:12 -0400)
Allows us to use **/*.xml for example as the archive parameter.

Change-Id: I5a92e198999a3db31fedc23e65f4c5315561f93c
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
jjb/include-raw-deploy-archives.sh
jjb/releng-macros.yaml

index 5b90f1df2ff67c07813f2e486a058156a6e12f06..56a77eaea65a6f25943cbc5d05d46542f5715a35 100644 (file)
@@ -50,6 +50,19 @@ cat > deploy-archives.xml <<EOF
 EOF
 
 mkdir -p $ARCHIVES_DIR
+mkdir -p $WORKSPACE/archives
+if [ ! -z $ARCHIVE_ARTIFACTS ]; then
+    pushd $WORKSPACE
+    shopt -s globstar  # Enable globstar to copy archives
+    archive_artifacts=$(echo $ARCHIVE_ARTIFACTS)
+    for f in $archive_artifacts; do
+        echo "Archiving $f"
+        mkdir -p $WORKSPACE/archives/$(dirname $f)
+        mv $f $WORKSPACE/archives/$f
+    done
+    shopt -u globstar  # Disable globstar once archives are copied
+    popd
+fi
 # Ignore logging if archives doesn't exist
 mv $WORKSPACE/archives/ $ARCHIVES_DIR > /dev/null 2>&1
 touch $ARCHIVES_DIR/_build-details.txt
index e98d8e3cd30c3c8f498e36d7f72e1fc2bc48d38b..119cab355f6d5beafb931840cd00f5f97d1ac608 100644 (file)
     # To archive things the job will need to create a "archives" directory in
     # the workspace and this macro will handle copying the contents of the
     # archives directory.
+    #
+    # Uses the build parameter ARCHIVE_ARTIFACTS if not empty to find files
+    # to archive. You can pass globstar patterns for example "**/*.xml **/*.log"
+    # as the archive pattern. This is a space separated list of files to archive.
+    #
     # Also ensure that the workspace is cleaned up at the end of the build.
     publishers:
         - postbuildscript: