Merge branch '19092-upload-crunchstat_summary-to-pypi'
[arvados-dev.git] / jenkins / run-cwl-test-suite.sh
1 #!/bin/bash
2
3 # Copyright (C) The Arvados Authors. All rights reserved.
4 #
5 # SPDX-License-Identifier: AGPL-3.0
6
7 set -o pipefail
8 set -e
9
10 DEBUG=0
11 JOBS=1
12
13 function usage {
14     echo >&2
15     echo >&2 "usage: $0 [options] <identifier>"
16     echo >&2
17     echo >&2 "   <identifier>                 Arvados cluster name"
18     echo >&2
19     echo >&2 "$0 options:"
20     echo >&2 "  -d, --debug                   Enable debug output"
21     echo >&2 "  -h, --help                    Display this help and exit"
22     echo >&2 "  -s, --scopes                  Print required scopes to run tests"
23     echo >&2 "  -j, --jobs <jobs>             Allow N jobs at once; 1 job with no arg."
24     echo >&2
25 }
26
27 function print_scopes {
28     echo >&2 " Required scope for the token used to run the tests:"
29     echo >&2
30     echo >&2 " arv api_client_authorization create_system_auth     --scopes "
31     echo >&2 "[\"GET /arvados/v1/virtual_machines\","
32     echo >&2 "\"GET /arvados/v1/keep_services\","
33     echo >&2 "\"GET /arvados/v1/keep_services/\","
34     echo >&2 "\"GET /arvados/v1/groups\","
35     echo >&2 "\"GET /arvados/v1/groups/\","
36     echo >&2 "\"GET /arvados/v1/links\","
37     echo >&2 "\"GET /arvados/v1/collections\","
38     echo >&2 "\"POST /arvados/v1/collections\","
39     echo >&2 "\"POST /arvados/v1/links\","
40     echo >&2 "\"GET /arvados/v1/users/current\","
41     echo >&2 "\"POST /arvados/v1/users/current\","
42     echo >&2 "\"GET /arvados/v1/jobs\","
43     echo >&2 "\"POST /arvados/v1/jobs\","
44     echo >&2 "\"GET /arvados/v1/pipeline_instances\","
45     echo >&2 "\"GET /arvados/v1/pipeline_instances/\","
46     echo >&2 "\"POST /arvados/v1/pipeline_instances\","
47     echo >&2 "\"GET /arvados/v1/collections/\","
48     echo >&2 "\"POST /arvados/v1/collections/\","
49     echo >&2 "\"GET /arvados/v1/container_requests\","
50     echo >&2 "\"GET /arvados/v1/container_requests/\","
51     echo >&2 "\"POST /arvados/v1/container_requests\","
52     echo >&2 "\"POST /arvados/v1/container_requests/\","
53     echo >&2 "\"GET /arvados/v1/containers\","
54     echo >&2 "\"GET /arvados/v1/containers/\","
55     echo >&2 "\"GET /arvados/v1/repositories\","
56     echo >&2 "\"GET /arvados/v1/repositories/\","
57     echo >&2 "\"GET /arvados/v1/logs\" ]"
58     echo >&2
59 }
60
61 # NOTE: This requires GNU getopt (part of the util-linux package on Debian-based distros).
62 TEMP=`getopt -o hdlp:sj: \
63     --long help,scopes,debug,jobs: \
64     -n "$0" -- "$@"`
65
66 if [ $? != 0 ] ; then echo "Use -h for help"; exit 1 ; fi
67 # Note the quotes around `$TEMP': they are essential!
68 eval set -- "$TEMP"
69
70 while [ $# -ge 1 ]
71 do
72     case $1 in
73         -d | --debug)
74             DEBUG=1
75             shift
76             ;;
77         -s | --scopes)
78             print_scopes
79             exit 0
80             ;;
81         -j | --jobs)
82             JOBS="$2"; shift 2
83             ;;
84         --)
85             shift
86             break
87             ;;
88         *)
89             usage
90             exit 1
91             ;;
92     esac
93 done
94
95
96 title () {
97   date=`date +'%Y-%m-%d %H:%M:%S'`
98   printf "%s\n" "$date $1"
99 }
100
101 title "Loading ARVADOS_API_HOST and ARVADOS_API_TOKEN"
102 if [[ "$ARVADOS_API_HOST" == "" ]] || [[ "$ARVADOS_API_TOKEN" == "" ]]; then
103   title "ERROR: ARVADOS_API_HOST and/or ARVADOS_API_TOKEN environment variables are not set."
104   exit 1
105 fi
106
107 if [[ ! -e cwl-v1.2 ]]; then
108   git clone --depth 1 https://github.com/common-workflow-language/cwl-v1.2.git
109 fi
110
111 cd cwl-v1.2
112 git fetch -t
113 git checkout v1.2.0
114 exec cwltest  -Sdocker_entrypoint,timelimit_invalid_wf -N307 \
115      -j$JOBS --timeout=900 --tool arvados-cwl-runner --test conformance_tests.yaml -- --compute-checksum --disable-reuse --eval-timeout 60