From f1ca9d0ff0e189bc0c98831417e5b371ec033e16 Mon Sep 17 00:00:00 2001 From: Anil Belur Date: Tue, 9 May 2017 21:49:44 +1000 Subject: [PATCH] Fix issue caused by process substitution on sh 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 --- jjb/autorelease/autorelease-macros.yaml | 9 +-------- .../include-raw-autorelease-collect-sar.sh | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 8 deletions(-) create mode 100644 jjb/autorelease/include-raw-autorelease-collect-sar.sh diff --git a/jjb/autorelease/autorelease-macros.yaml b/jjb/autorelease/autorelease-macros.yaml index 5275b52aa..620639584 100644 --- a/jjb/autorelease/autorelease-macros.yaml +++ b/jjb/autorelease/autorelease-macros.yaml @@ -157,13 +157,6 @@ 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 index 000000000..43035391f --- /dev/null +++ b/jjb/autorelease/include-raw-autorelease-collect-sar.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# @License 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]*") -- 2.36.6