2016-11-30 06:21:53 +01:00
|
|
|
#!/bin/bash -eux
|
|
|
|
|
|
|
|
set -o pipefail
|
|
|
|
|
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]}"
|
|
|
|
target="windows/ci/group${args[2]}/"
|
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=(
|
|
|
|
2.6
|
|
|
|
3.5
|
|
|
|
3.6
|
|
|
|
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
|
2017-09-06 00:32:26 +02:00
|
|
|
ansible-test windows-integration "${target}" --explain ${CHANGED:+"$CHANGED"} 2>&1 | { grep ' windows-integration: .* (targeted)$' || 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"
|
|
|
|
|
|
|
|
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}"
|
|
|
|
if [ "${target}" == "windows/ci/group1/" ]; then
|
|
|
|
# only run smoketest tests for group1
|
|
|
|
changed_all_target="windows/ci/smoketest/"
|
|
|
|
else
|
|
|
|
# smoketest tests already covered by group1
|
|
|
|
changed_all_target="none"
|
|
|
|
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
|
|
|
|
if [ "${target}" != "windows/ci/group1/" ]; then continue; fi
|
2017-07-15 01:51:32 +02:00
|
|
|
# minimal tests for other python versions
|
|
|
|
ci="windows/ci/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
|
2017-10-26 09:21:46 +02:00
|
|
|
ansible-test windows-integration --color -v --retry-on-error "${ci}" --docker default --python "${version}" ${COVERAGE:+"$COVERAGE"} ${CHANGED:+"$CHANGED"} \
|
2017-11-29 09:46:08 +01:00
|
|
|
"${platforms[@]}" --changed-all-target "${changed_all_target}" \
|
|
|
|
--remote-terminate "${terminate}" --remote-stage "${stage}" --remote-provider "${provider}"
|
2017-05-18 19:37:53 +02:00
|
|
|
done
|