Files
weave-scope/extras/in_parallel.sh
Alessandro Puccetti 6b2b483cbc extras/in_parallel.sh: remove erroneous quotes
$COMMAND can contain "make RM="

This patch fixes a regression caused by
https://github.com/weaveworks/scope/pull/2068/files#diff-42138a4802cce915f347919ccd707876R28
2017-02-22 11:16:51 +01:00

33 lines
736 B
Bash
Executable File

#!/bin/sh
set -e
if [ $# -lt 2 ]; then
echo "Usage: $0 <cmd> [args...]"
echo " Will run cmd arg1, cmd arg2 etc on different circle shared,"
echo " based on what the scheduler says."
exit 2
fi
if [ -z "$CIRCLECI" ]; then
echo "I'm afraid this only works when run on CircleCI"
exit 1
fi
COMMAND=$1
shift 1
INPUTS="$*"
SCHED_NAME=parallel-$CIRCLE_PROJECT_USERNAME-$CIRCLE_PROJECT_REPONAME-$CIRCLE_BUILD_NUM
INPUTS=$(echo "$INPUTS" | python "../tools/sched" sched "$SCHED_NAME" "$CIRCLE_NODE_TOTAL" "$CIRCLE_NODE_INDEX")
echo Doing "$INPUTS"
for INPUT in $INPUTS; do
START=$(date +%s)
$COMMAND "$INPUT"
RUNTIME=$(($(date +%s) - START))
python "../tools/sched" time "$INPUT" "$RUNTIME"
done