Improve archive-build macro to gzip any text file 83/4083/1
authorAnil Belur <abelur@linuxfoundation.org>
Tue, 12 Jul 2016 05:55:08 +0000 (11:25 +0530)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Sat, 4 Mar 2017 19:13:50 +0000 (14:13 -0500)
Change-Id: I5a782147ec7f11fa353fbf01ea6d7fc117757346
Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
include-raw-deploy-archives.sh

index 56a77ea..79a86d5 100644 (file)
@@ -75,11 +75,12 @@ wget -O $ARCHIVES_DIR/_console-output.log ${{BUILD_URL}}consoleText
 sed -i '/^-----END_OF_BUILD-----$/,$d' $ARCHIVES_DIR/_console-output.log
 
 gzip $ARCHIVES_DIR/*.txt $ARCHIVES_DIR/*.log
-# find and gzip all text files
-find $ARCHIVES_DIR -name "*.txt" \
-                -o -name "*.log" \
-                -o -name "*.html" \
-                | xargs gzip
+# find and gzip any 'text' files
+find $ARCHIVES_DIR -type f -print0 \
+                | xargs -0r file \
+                | egrep -e ':.*text.*' \
+                | cut -d: -f1 \
+                | xargs -d'\n' -r gzip
 
 zip -r archives.zip $JENKINS_HOSTNAME/
 du -sh archives.zip