Fix issue caused by process substitution on sh 15/56715/1
authorAnil Belur <abelur@linuxfoundation.org>
Tue, 9 May 2017 11:49:44 +0000 (21:49 +1000)
committerAnil Belur <abelur@linuxfoundation.org>
Tue, 9 May 2017 11:49:44 +0000 (21:49 +1000)
The change fixes the issue 'syntax error near unexpected token `<''
which is caused because the while loop and find uses process
substitution feature which is not standard on all shells. The
default shell used to run a builder is 'sh'. To fix the issue
invoke the code from a script using bash.

Change-Id: Icac081a6ca1aa19cdcef8202cd943348e6dbc513
Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
jjb/autorelease/autorelease-macros.yaml
jjb/autorelease/include-raw-autorelease-collect-sar.sh [new file with mode: 0644]

index 5275b52aa1eac321a1862cf40dd9fcdc2dd6e32a..6206395840be8ba23c62e7be40abdcf72f2c58b9 100644 (file)
     publishers:
       - postbuildscript:
           builders:
-            - shell: |
-                mkdir -p archives/
-                cp /var/log/sa/* $_
-                # convert sar data to ascii format
-                while IFS="" read -r s
-                do
-                    [ -f "$s" ] && sar -A -f "$s" > archives/sar/sar${s//[!0-9]/}
-                done < <(find /var/log/{sa,sysstat} -name "sa[0-9]*")
+            - shell: !include-raw: include-raw-autorelease-collect-sar.sh
           script-only-if-succeeded: false
           script-only-if-failed: false
diff --git a/jjb/autorelease/include-raw-autorelease-collect-sar.sh b/jjb/autorelease/include-raw-autorelease-collect-sar.sh
new file mode 100644 (file)
index 0000000..4303539
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/bash
+# @License EPL-1.0 <http://spdx.org/licenses/EPL-1.0>
+##############################################################################
+# Copyright (c) 2017 The Linux Foundation and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+##############################################################################
+
+mkdir -p archives/
+cp /var/log/sa/* $_
+# convert sar data to ascii format
+while IFS="" read -r s
+do
+    [ -f "$s" ] && sar -A -f "$s" > archives/sar/sar${s//[!0-9]/}
+done < <(find /var/log/{sa,sysstat} -name "sa[0-9]*")