2019-02-18 22:41:45 +01:00
|
|
|
#!/usr/bin/env bash
|
2016-11-30 06:21:53 +01:00
|
|
|
|
2019-02-18 22:41:45 +01:00
|
|
|
set -o pipefail -eux
|
2016-11-30 06:21:53 +01:00
|
|
|
|
2017-09-06 00:32:26 +02:00
|
|
|
declare -a args
|
2017-10-03 21:43:46 +02:00
|
|
|
IFS='/:' read -ra args <<< "$1"
|
2017-09-06 00:32:26 +02:00
|
|
|
|
2018-02-09 23:31:19 +01:00
|
|
|
version="${args[1]}"
|
2018-07-24 05:46:22 +02:00
|
|
|
group="${args[2]}"
|
|
|
|
|
|
|
|
target="shippable/windows/group${group}/"
|
2017-09-06 00:32:26 +02:00
|
|
|
|
2017-11-29 09:46:08 +01:00
|
|
|
stage="${S:-prod}"
|
|
|
|
provider="${P:-default}"
|
|
|
|
|
2017-05-18 19:37:53 +02:00
|
|
|
# python versions to test in order
|
|
|
|
# python 2.7 runs full tests while other versions run minimal tests
|
|
|
|
python_versions=(
|
|
|
|
3.5
|
|
|
|
3.6
|
2018-10-02 21:26:14 +02:00
|
|
|
3.7
|
2019-02-13 09:53:05 +01:00
|
|
|
3.8
|
2017-05-18 19:37:53 +02:00
|
|
|
2.7
|
|
|
|
)
|
|
|
|
|
2018-02-09 23:31:19 +01:00
|
|
|
# version to test when only testing a single version
|
|
|
|
single_version=2012-R2
|
|
|
|
|
2017-05-14 09:04:52 +02:00
|
|
|
# shellcheck disable=SC2086
|
2019-07-17 23:46:37 +02:00
|
|
|
ansible-test windows-integration --explain ${CHANGED:+"$CHANGED"} ${UNSTABLE:+"$UNSTABLE"} > /tmp/explain.txt 2>&1 || { cat /tmp/explain.txt && false; }
|
|
|
|
{ grep ' windows-integration: .* (targeted)$' /tmp/explain.txt || true; } > /tmp/windows.txt
|
2016-11-30 06:21:53 +01:00
|
|
|
|
2017-09-14 07:21:19 +02:00
|
|
|
if [ -s /tmp/windows.txt ] || [ "${CHANGED:+$CHANGED}" == "" ]; then
|
2016-11-30 06:21:53 +01:00
|
|
|
echo "Detected changes requiring integration tests specific to Windows:"
|
|
|
|
cat /tmp/windows.txt
|
|
|
|
|
|
|
|
echo "Running Windows integration tests for multiple versions concurrently."
|
|
|
|
|
2017-05-18 19:37:53 +02:00
|
|
|
platforms=(
|
2018-02-09 23:31:19 +01:00
|
|
|
--windows "${version}"
|
2017-05-18 19:37:53 +02:00
|
|
|
)
|
2016-11-30 06:21:53 +01:00
|
|
|
else
|
|
|
|
echo "No changes requiring integration tests specific to Windows were detected."
|
2018-02-09 23:31:19 +01:00
|
|
|
echo "Running Windows integration tests for a single version only: ${single_version}"
|
|
|
|
|
|
|
|
if [ "${version}" != "${single_version}" ]; then
|
|
|
|
echo "Skipping this job since it is for: ${version}"
|
|
|
|
exit 0
|
|
|
|
fi
|
2016-11-30 06:21:53 +01:00
|
|
|
|
2017-05-18 19:37:53 +02:00
|
|
|
platforms=(
|
2018-02-09 23:31:19 +01:00
|
|
|
--windows "${version}"
|
2017-05-18 19:37:53 +02:00
|
|
|
)
|
2016-11-30 06:21:53 +01:00
|
|
|
fi
|
2017-05-18 19:37:53 +02:00
|
|
|
|
|
|
|
for version in "${python_versions[@]}"; do
|
2017-07-15 01:51:32 +02:00
|
|
|
changed_all_target="all"
|
2018-10-02 21:26:14 +02:00
|
|
|
changed_all_mode="default"
|
2017-07-15 01:51:32 +02:00
|
|
|
|
|
|
|
if [ "${version}" == "2.7" ]; then
|
|
|
|
# smoketest tests for python 2.7
|
|
|
|
if [ "${CHANGED}" ]; then
|
|
|
|
# with change detection enabled run tests for anything changed
|
|
|
|
# use the smoketest tests for any change that triggers all tests
|
2017-09-06 00:32:26 +02:00
|
|
|
ci="${target}"
|
2018-10-02 21:26:14 +02:00
|
|
|
changed_all_target="shippable/windows/smoketest/"
|
2018-07-24 05:46:22 +02:00
|
|
|
if [ "${target}" == "shippable/windows/group1/" ]; then
|
2017-09-06 00:32:26 +02:00
|
|
|
# only run smoketest tests for group1
|
2018-10-02 21:26:14 +02:00
|
|
|
changed_all_mode="include"
|
2017-09-06 00:32:26 +02:00
|
|
|
else
|
|
|
|
# smoketest tests already covered by group1
|
2018-10-02 21:26:14 +02:00
|
|
|
changed_all_mode="exclude"
|
2017-09-06 00:32:26 +02:00
|
|
|
fi
|
2017-05-18 19:37:53 +02:00
|
|
|
else
|
2017-09-14 07:21:19 +02:00
|
|
|
# without change detection enabled run entire test group
|
|
|
|
ci="${target}"
|
2017-05-18 19:37:53 +02:00
|
|
|
fi
|
2017-07-15 01:51:32 +02:00
|
|
|
else
|
2017-09-06 00:32:26 +02:00
|
|
|
# only run minimal tests for group1
|
2018-07-24 05:46:22 +02:00
|
|
|
if [ "${target}" != "shippable/windows/group1/" ]; then continue; fi
|
2017-07-15 01:51:32 +02:00
|
|
|
# minimal tests for other python versions
|
2018-07-24 05:46:22 +02:00
|
|
|
ci="shippable/windows/minimal/"
|
2017-05-18 19:37:53 +02:00
|
|
|
fi
|
2017-07-15 01:51:32 +02:00
|
|
|
|
2017-11-15 02:08:48 +01:00
|
|
|
# terminate remote instances on the final python version tested
|
|
|
|
if [ "${version}" = "${python_versions[-1]}" ]; then
|
|
|
|
terminate="always"
|
|
|
|
else
|
|
|
|
terminate="never"
|
|
|
|
fi
|
|
|
|
|
2017-07-15 01:51:32 +02:00
|
|
|
# shellcheck disable=SC2086
|
2018-04-13 01:15:28 +02:00
|
|
|
ansible-test windows-integration --color -v --retry-on-error "${ci}" ${COVERAGE:+"$COVERAGE"} ${CHANGED:+"$CHANGED"} ${UNSTABLE:+"$UNSTABLE"} \
|
2018-10-02 21:26:14 +02:00
|
|
|
"${platforms[@]}" --changed-all-target "${changed_all_target}" --changed-all-mode "${changed_all_mode}" \
|
2018-04-13 01:15:28 +02:00
|
|
|
--docker default --python "${version}" \
|
2017-11-29 09:46:08 +01:00
|
|
|
--remote-terminate "${terminate}" --remote-stage "${stage}" --remote-provider "${provider}"
|
2017-05-18 19:37:53 +02:00
|
|
|
done
|