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