11 echo >&2 "usage: $0 [options] <identifier>"
13 echo >&2 " <identifier> Arvados cluster name"
15 echo >&2 "$0 options:"
16 echo >&2 " -p, --port <ssh port> SSH port to use (default 22)"
17 echo >&2 " --acct <username> Account to log in with"
18 echo >&2 " -d, --debug Enable debug output"
19 echo >&2 " -h, --help Display this help and exit"
21 echo >&2 " Required scope for the token used to run the tests:"
23 echo >&2 " arv api_client_authorization create_system_auth --scopes "
24 echo >&2 "[\"GET /arvados/v1/virtual_machines\","
25 echo >&2 "\"GET /arvados/v1/keep_services\","
26 echo >&2 "\"GET /arvados/v1/keep_services/\","
27 echo >&2 "\"GET /arvados/v1/groups\","
28 echo >&2 "\"GET /arvados/v1/groups/\","
29 echo >&2 "\"GET /arvados/v1/links\","
30 echo >&2 "\"GET /arvados/v1/collections\","
31 echo >&2 "\"POST /arvados/v1/collections\","
32 echo >&2 "\"POST /arvados/v1/links\","
33 echo >&2 "\"GET /arvados/v1/users/current\","
34 echo >&2 "\"POST /arvados/v1/users/current\","
35 echo >&2 "\"GET /arvados/v1/jobs\","
36 echo >&2 "\"POST /arvados/v1/jobs\","
37 echo >&2 "\"GET /arvados/v1/pipeline_instances\","
38 echo >&2 "\"GET /arvados/v1/pipeline_instances/\","
39 echo >&2 "\"POST /arvados/v1/pipeline_instances\","
40 echo >&2 "\"GET /arvados/v1/collections/\","
41 echo >&2 "\"POST /arvados/v1/collections/\","
42 echo >&2 "\"GET /arvados/v1/container_requests\","
43 echo >&2 "\"GET /arvados/v1/container_requests/\","
44 echo >&2 "\"POST /arvados/v1/container_requests\","
45 echo >&2 "\"POST /arvados/v1/container_requests/\","
46 echo >&2 "\"GET /arvados/v1/containers\","
47 echo >&2 "\"GET /arvados/v1/containers/\","
48 echo >&2 "\"GET /arvados/v1/logs\" ]"
52 # NOTE: This requires GNU getopt (part of the util-linux package on Debian-based distros).
53 TEMP=`getopt -o hdp: \
54 --long help,debug,port:,acct: \
57 if [ $? != 0 ] ; then echo "Use -h for help"; exit 1 ; fi
58 # Note the quotes around `$TEMP': they are essential!
65 SSH_PORT="$2"; shift 2
87 if [[ "$IDENTIFIER" == '' ]]; then
98 let endtime="$(now) + 600"
99 while [ "$endtime" -gt "$(now)" ]; do
100 puppet agent --test --detailed-exitcodes
102 if [ 0 = "$agent_exitcode" ] || [ 2 = "$agent_exitcode" ]; then
108 exit ${agent_exitcode:-99}
112 date=`date +'%Y-%m-%d %H:%M:%S'`
113 printf "%s\n" "$date $1"
116 function run_command() {
121 title "Running '${command/ARVADOS_API_TOKEN=*/ARVADOS_API_TOKEN=suppressed}' on $node"
123 if [[ "$DEBUG" != "0" ]]; then
124 ssh -t -p$SSH_PORT -o "StrictHostKeyChecking no" -o "ConnectTimeout 125" $ACCT@$node -C "$command" | tee $TMP_FILE
127 ssh -t -p$SSH_PORT -o "StrictHostKeyChecking no" -o "ConnectTimeout 125" $ACCT@$node -C "$command" > $TMP_FILE 2>&1
131 if [[ "$ECODE" != "255" && "$ECODE" != "0" ]]; then
132 # Ssh exists 255 if the connection timed out. Just ignore that, it's possible that this node is
133 # a shell node that is down.
134 title "ERROR running command on $node: exit code $ECODE"
135 if [[ "$DEBUG" == "0" ]]; then
136 title "Command output follows:"
140 if [[ "$ECODE" == "255" ]]; then
141 title "Connection denied or timed out"
144 eval "$return_var=$ECODE"
147 title "Loading ARVADOS_API_HOST and ARVADOS_API_TOKEN"
148 if [[ -f "$HOME/.config/arvados/$IDENTIFIER.arvadosapi.com.conf" ]]; then
149 . $HOME/.config/arvados/$IDENTIFIER.arvadosapi.com.conf
151 title "WARNING: $HOME/.config/arvados/$IDENTIFIER.arvadosapi.com.conf not found."
153 if [[ "$ARVADOS_API_HOST" == "" ]] || [[ "$ARVADOS_API_TOKEN" == "" ]]; then
154 title "ERROR: ARVADOS_API_HOST and/or ARVADOS_API_TOKEN environment variables are not set."
158 run_command shell.$IDENTIFIER ECODE "if [[ ! -e common-workflow-language ]]; then git clone https://github.com/common-workflow-language/common-workflow-language.git; fi"
160 if [[ "$ECODE" != "0" ]]; then
161 echo "Failed to git clone https://github.com/common-workflow-language/common-workflow-language.git"
165 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"
167 if [[ "$ECODE" != "0" ]]; then
168 echo "Failed to create ~$ACCT/arvados-cwl-runner-with-checksum.sh"
172 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/$ACCT/arvados-cwl-runner-with-checksum.sh "