-
Notifications
You must be signed in to change notification settings - Fork 2
/
testall
executable file
·170 lines (141 loc) · 7.63 KB
/
testall
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
#!/bin/sh
. ./default_build_params
set -x
# Allow full override of ALL Jenkins params before running test suite.
# Intended to overrride all params in Jenkinsfile.
#
# This `CONFIG_PARAMETERS_SCRIPT_URL` is different than the
# `CONFIG_OVERRIDE_SCRIPT_URL` in that it overrides all the
# Jenkins params much sooner so all regular processing can take place.
#
# When the regular processing are not enough and we need additional
# customizations, then we use the other `CONFIG_OVERRIDE_SCRIPT_URL`.
#
# The two override scripts complement each other by hooking into the
# process at different moment in time, and together they allow full
# complete override of the various options for the test run.
#
# Furthermore, CONFIG_OVERRIDE_SCRIPT_URL can also be a local file that is
# created on the fly by CONFIG_PARAMETERS_SCRIPT_URL. So in the end, only
# CONFIG_PARAMETERS_SCRIPT_URL is needed for a full complete override.
# See example in test-override/jenkins-params-raven-specific-nb.include.sh.
if [ -n "$CONFIG_PARAMETERS_SCRIPT_URL" ]; then
TMP_PARAMS_OVERRIDE="/tmp/jenkins_params_override"
rm -vf "$TMP_PARAMS_OVERRIDE"
# Use tee to log content of override script for traceability.
curl --silent "$CONFIG_PARAMETERS_SCRIPT_URL" | tee "$TMP_PARAMS_OVERRIDE"
# Source script so it can alter ALL existing variables in the current context.
. "$TMP_PARAMS_OVERRIDE"
fi
# emulate "clean after checkout" of single branch pipeline
git clean -fdx
# download all additional repos containing extra notebooks to test
./downloadrepos
# 'export' useful vars so they can be used by the CONFIG_OVERRIDE_SCRIPT_URL in runtest.
# replace all slash (/) by dash (-) because (/) is illegal in folder name
# for branch name of the format "feature/my_wizbang-feature"
# github does the same when downloading repo archive by downloadrepos above
export PAVICS_SDI_BRANCH="`echo "$PAVICS_SDI_BRANCH" | sed "s@/@-@g"`"
export PAVICS_SDI_REPO_NAME="`echo "$PAVICS_SDI_REPO" | sed "s@^.*/@@g"`"
export FINCH_BRANCH="`echo "$FINCH_BRANCH" | sed "s@/@-@g"`"
export FINCH_REPO_NAME="`echo "$FINCH_REPO" | sed "s@^.*/@@g"`"
export PAVICS_LANDING_BRANCH="`echo "$PAVICS_LANDING_BRANCH" | sed "s@/@-@g"`"
export PAVICS_LANDING_REPO_NAME="`echo "$PAVICS_LANDING_REPO" | sed "s@^.*/@@g"`"
export RAVEN_BRANCH="`echo "$RAVEN_BRANCH" | sed "s@/@-@g"`"
export RAVEN_REPO_NAME="`echo "$RAVEN_REPO" | sed "s@^.*/@@g"`"
export RAVENPY_BRANCH="`echo "$RAVENPY_BRANCH" | sed "s@/@-@g"`"
export RAVENPY_REPO_NAME="`echo "$RAVENPY_REPO" | sed "s@^.*/@@g"`"
export ESGF_COMPUTE_API_BRANCH="`echo "$ESGF_COMPUTE_API_BRANCH" | sed "s@/@-@g"`"
export ESGF_COMPUTE_API_REPO_NAME="`echo "$ESGF_COMPUTE_API_REPO" | sed "s@^.*/@@g"`"
# branches that have allowed characters such as '+' other than alphanum, '-' and '_' are converted to '-' in archives
export PAVICS_SDI_DIR=`echo "${PAVICS_SDI_REPO_NAME}-${PAVICS_SDI_BRANCH}" | sed "s@[^a-zA-Z0-9_\-\.]@-@g"`
export FINCH_DIR=`echo "${FINCH_REPO_NAME}-${FINCH_BRANCH}" | sed "s@[^a-zA-Z0-9_\-\.]@-@g"`
export PAVICS_LANDING_DIR=`echo "${PAVICS_LANDING_REPO_NAME}-${PAVICS_LANDING_BRANCH}" | sed "s@[^a-zA-Z0-9_\-\.]@-@g"`
export RAVEN_DIR=`echo "${RAVEN_REPO_NAME}-${RAVEN_BRANCH}" | sed "s@[^a-zA-Z0-9_\-\.]@-@g"`
export RAVENPY_DIR=`echo "${RAVENPY_REPO_NAME}-${RAVENPY_BRANCH}" | sed "s@[^a-zA-Z0-9_\-\.]@-@g"`
export ESGF_COMPUTE_API_DIR=`echo "${ESGF_COMPUTE_API_REPO_NAME}-${ESGF_COMPUTE_API_BRANCH}" | sed "s@[^a-zA-Z0-9_\-\.]@-@g"`
# lowercase VERIFY_SSL string
VERIFY_SSL="`echo "$VERIFY_SSL" | tr '[:upper:]' '[:lower:]'`"
if [ x"$VERIFY_SSL" = xfalse ]; then
# if Env var DISABLE_VERIFY_SSL is present, notebook should disable ssl
# cert verification
# in notebook use:
# verify_ssl = True if 'DISABLE_VERIFY_SSL' not in os.environ else False
export DISABLE_VERIFY_SSL=1
echo "setting env var DISABLE_VERIFY_SSL for notebooks"
fi
# presence of setup.cfg, tox.ini, pyproject.toml files confuse py.test execution rootdir discovery
rm -v $FINCH_REPO_NAME-$FINCH_BRANCH/setup.cfg
rm -v $RAVEN_REPO_NAME-$RAVEN_BRANCH/setup.cfg
rm -v $RAVEN_REPO_NAME-$RAVEN_BRANCH/pyproject.toml
rm -v $RAVENPY_REPO_NAME-$RAVENPY_BRANCH/setup.cfg
rm -v $RAVENPY_REPO_NAME-$RAVENPY_BRANCH/tox.ini
rm -v $RAVENPY_REPO_NAME-$RAVENPY_BRANCH/pyproject.toml
rm -v $ESGF_COMPUTE_API_REPO_NAME-$ESGF_COMPUTE_API_BRANCH/setup.cfg
rm -v $ESGF_COMPUTE_API_REPO_NAME-$ESGF_COMPUTE_API_BRANCH/tox.ini
# lowercase
TEST_MAGPIE_AUTH="`echo "$TEST_MAGPIE_AUTH" | tr '[:upper:]' '[:lower:]'`"
TEST_PAVICS_SDI_REPO="`echo "$TEST_PAVICS_SDI_REPO" | tr '[:upper:]' '[:lower:]'`"
TEST_PAVICS_SDI_WEAVER="`echo "$TEST_PAVICS_SDI_WEAVER" | tr '[:upper:]' '[:lower:]'`"
TEST_FINCH_REPO="`echo "$TEST_FINCH_REPO" | tr '[:upper:]' '[:lower:]'`"
TEST_PAVICS_LANDING_REPO="`echo "$TEST_PAVICS_LANDING_REPO" | tr '[:upper:]' '[:lower:]'`"
TEST_RAVEN_REPO="`echo "$TEST_RAVEN_REPO" | tr '[:upper:]' '[:lower:]'`"
TEST_RAVENPY_REPO="`echo "$TEST_RAVENPY_REPO" | tr '[:upper:]' '[:lower:]'`"
TEST_ESGF_COMPUTE_API_REPO="`echo "$TEST_ESGF_COMPUTE_API_REPO" | tr '[:upper:]' '[:lower:]'`"
TEST_LOCAL_NOTEBOOKS="`echo "$TEST_LOCAL_NOTEBOOKS" | tr '[:upper:]' '[:lower:]'`"
NOTEBOOKS_TO_TEST=""
if [ x"$TEST_MAGPIE_AUTH" = xtrue ]; then
NOTEBOOKS_TO_TEST="$NOTEBOOKS_TO_TEST notebooks-auth/*.ipynb"
fi
if [ x"$TEST_PAVICS_SDI_REPO" = xtrue ]; then
NOTEBOOKS_TO_TEST="$NOTEBOOKS_TO_TEST ${PAVICS_SDI_DIR}/docs/source/notebooks/*.ipynb"
if [ x"$TEST_PAVICS_SDI_WEAVER" = xtrue ]; then
NOTEBOOKS_TO_TEST="$NOTEBOOKS_TO_TEST ${PAVICS_SDI_DIR}/docs/source/notebook-components/*weaver*.ipynb"
fi
fi
if [ x"$TEST_FINCH_REPO" = xtrue ]; then
NOTEBOOKS_TO_TEST="$NOTEBOOKS_TO_TEST ${FINCH_DIR}/docs/source/notebooks/*.ipynb"
fi
if [ x"$TEST_PAVICS_LANDING_REPO" = xtrue ]; then
NOTEBOOKS_TO_TEST="$NOTEBOOKS_TO_TEST ${PAVICS_LANDING_DIR}/content/notebooks/climate_indicators/*.ipynb"
NOTEBOOKS_TO_TEST="$NOTEBOOKS_TO_TEST ${PAVICS_LANDING_DIR}/content/notebooks/hydrology/*.ipynb"
SETUP_SCRIPT="${PAVICS_LANDING_DIR}/content/notebooks/climate_indicators/setup_dirlayout.sh"
if [ -x "$SETUP_SCRIPT" ]; then
# Delegate extra files layout setup to source repo so this setup_dirlayout.sh
# becomes a stable interface between this repo and the source repo.
# Any future layout changes will be seemless for this repo.
$SETUP_SCRIPT
fi
fi
if [ x"$TEST_RAVEN_REPO" = xtrue ]; then
NOTEBOOKS_TO_TEST="$NOTEBOOKS_TO_TEST ${RAVEN_DIR}/docs/source/notebooks/*.ipynb"
fi
if [ x"$TEST_RAVENPY_REPO" = xtrue ]; then
NOTEBOOKS_TO_TEST="$NOTEBOOKS_TO_TEST ${RAVENPY_DIR}/docs/notebooks/*.ipynb"
NOTEBOOKS_TO_TEST="$NOTEBOOKS_TO_TEST ${RAVENPY_DIR}/docs/notebooks/paper/*.ipynb"
fi
if [ x"$TEST_ESGF_COMPUTE_API_REPO" = xtrue ]; then
NOTEBOOKS_TO_TEST="$NOTEBOOKS_TO_TEST ${ESGF_COMPUTE_API_DIR}/examples/*.ipynb"
fi
if [ x"$TEST_LOCAL_NOTEBOOKS" = xtrue ]; then
# Add notebooks here last since stress-test.ipynb can possible cause cascading
# damage to other notebooks.
NOTEBOOKS_TO_TEST="$NOTEBOOKS_TO_TEST notebooks/*.ipynb"
fi
# last notebooks higher chance for name clash
./runtest "$NOTEBOOKS_TO_TEST"
EXIT_CODE="$?"
### Save conda env details for manual reproducibility outside of docker image.
ENV_DUMP_DIR="buildout/env-dump"
mkdir -p $ENV_DUMP_DIR
ENV_EXPORT_FILE="$ENV_DUMP_DIR/environment-export-birdy.yml"
rm -fv $ENV_EXPORT_FILE
conda env export -n birdy > $ENV_EXPORT_FILE
LIST_EXPLICIT_FILE="$ENV_DUMP_DIR/conda-list-explicit-birdy.txt"
rm -fv $LIST_EXPLICIT_FILE
conda list -n birdy --explicit > $LIST_EXPLICIT_FILE
PIP_FREEZE_FILE="$ENV_DUMP_DIR/pip-freeze-birdy-requirements.txt"
rm -fv $PIP_FREEZE_FILE
pip freeze > $PIP_FREEZE_FILE
# exit with runtest exit code
exit $EXIT_CODE