From: Ward Vandewege Date: Thu, 22 Sep 2016 20:59:22 +0000 (-0400) Subject: Upgrade run-cwl-test.sh a bit: X-Git-Url: https://git.arvados.org/arvados-dev.git/commitdiff_plain/0feb39d6a7818824524a57d8c8d9d304bc822121 Upgrade run-cwl-test.sh a bit: * no longer run as root on the destination (ugh, seriously!) * make it set up its requirements itself if they aren't present No issue # --- diff --git a/jenkins/run-cwl-test.sh b/jenkins/run-cwl-test.sh index d98a73b..3318d48 100755 --- a/jenkins/run-cwl-test.sh +++ b/jenkins/run-cwl-test.sh @@ -73,7 +73,7 @@ exit ${agent_exitcode:-99} title () { date=`date +'%Y-%m-%d %H:%M:%S'` - printf "$date $1\n" + printf "%s\n" "$date $1" } function run_command() { @@ -81,16 +81,15 @@ function run_command() { return_var=$2 command=$3 - title "Running '$command' on $node" + title "Running '${command/ARVADOS_API_TOKEN=??????????????????????????????????????????????????/ARVADOS_API_TOKEN=suppressed}' on $node" TMP_FILE=`mktemp` if [[ "$DEBUG" != "0" ]]; then - ssh -t -p$SSH_PORT -o "StrictHostKeyChecking no" -o "ConnectTimeout 125" root@$node -C "$command" | tee $TMP_FILE + ssh -t -p$SSH_PORT -o "StrictHostKeyChecking no" -o "ConnectTimeout 125" ci@$node -C "$command" | tee $TMP_FILE else - ssh -t -p$SSH_PORT -o "StrictHostKeyChecking no" -o "ConnectTimeout 125" root@$node -C "$command" > $TMP_FILE 2>&1 + ssh -t -p$SSH_PORT -o "StrictHostKeyChecking no" -o "ConnectTimeout 125" ci@$node -C "$command" > $TMP_FILE 2>&1 fi ECODE=$? - RESULT=$(cat $TMP_FILE) if [[ "$ECODE" != "255" && "$ECODE" != "0" ]]; then # Ssh exists 255 if the connection timed out. Just ignore that, it's possible that this node is @@ -98,7 +97,7 @@ function run_command() { title "ERROR running command on $node: exit code $ECODE" if [[ "$DEBUG" == "0" ]]; then title "Command output follows:" - echo $RESULT + cat $TMP_FILE fi fi if [[ "$ECODE" == "255" ]]; then @@ -120,10 +119,21 @@ if [[ "$ARVADOS_API_HOST" == "" ]] || [[ "$ARVADOS_API_TOKEN" == "" ]]; then exit 1 fi -## FIXME: add a git clone if common-workflow-language dir isn't there -## FIXME: create /root/arvados-cwl-runner-with-checksum.sh (#!/bin/sh\nexec arvados-cwl-runner --compute-checksum "$@") instead of assuming it's there +run_command shell.$IDENTIFIER ECODE "if [[ ! -e common-workflow-language ]]; then git clone https://github.com/common-workflow-language/common-workflow-language.git; fi" -run_command shell.$IDENTIFIER ECODE "cd common-workflow-language; git pull; ARVADOS_API_HOST=$ARVADOS_API_HOST ARVADOS_API_TOKEN=$ARVADOS_API_TOKEN ./run_test.sh RUNNER=/root/arvados-cwl-runner-with-checksum.sh " +if [[ "$ECODE" != "0" ]]; then + echo "Failed to git clone https://github.com/common-workflow-language/common-workflow-language.git" + exit $ECODE +fi + +run_command shell.$IDENTIFIER ECODE "if [[ ! -e arvados-cwl-runner-with-checksum.sh ]]; then printf \"%s\n%s\n\" '#!/bin/sh' 'exec arvados-cwl-runner --compute-checksum \"\$@\"' > arvados-cwl-runner-with-checksum.sh; chmod 755 arvados-cwl-runner-with-checksum.sh; fi" + +if [[ "$ECODE" != "0" ]]; then + echo "Failed to create ~ci/arvados-cwl-runner-with-checksum.sh" + exit $ECODE +fi + +run_command shell.$IDENTIFIER ECODE "cd common-workflow-language; git pull; ARVADOS_API_HOST=$ARVADOS_API_HOST ARVADOS_API_TOKEN=$ARVADOS_API_TOKEN ./run_test.sh RUNNER=/home/ci/arvados-cwl-runner-with-checksum.sh " exit $ECODE