mirror of https://github.com/ansible/ansible.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
95 lines
3.4 KiB
Bash
95 lines
3.4 KiB
Bash
6 years ago
|
#!/usr/bin/env bash
|
||
8 years ago
|
|
||
6 years ago
|
set -o pipefail -eux
|
||
8 years ago
|
|
||
7 years ago
|
declare -a args
|
||
7 years ago
|
IFS='/:' read -ra args <<< "$1"
|
||
7 years ago
|
|
||
7 years ago
|
version="${args[1]}"
|
||
6 years ago
|
group="${args[2]}"
|
||
|
|
||
|
target="shippable/windows/group${group}/"
|
||
7 years ago
|
|
||
7 years ago
|
stage="${S:-prod}"
|
||
|
provider="${P:-default}"
|
||
|
|
||
8 years ago
|
# python versions to test in order
|
||
4 years ago
|
IFS=' ' read -r -a python_versions <<< \
|
||
3 years ago
|
"$(PYTHONPATH="${PWD}/test/lib" python -c 'from ansible_test._internal import constants; print(" ".join(constants.CONTROLLER_PYTHON_VERSIONS))')"
|
||
4 years ago
|
|
||
|
# python version to run full tests on while other versions run minimal tests
|
||
3 years ago
|
python_default="$(PYTHONPATH="${PWD}/test/lib" python -c 'from ansible_test._internal import constants; print(constants.CONTROLLER_MIN_PYTHON_VERSION)')"
|
||
8 years ago
|
|
||
7 years ago
|
# version to test when only testing a single version
|
||
|
single_version=2012-R2
|
||
|
|
||
8 years ago
|
# shellcheck disable=SC2086
|
||
3 years ago
|
ansible-test windows-integration --list-targets -v ${CHANGED:+"$CHANGED"} ${UNSTABLE:+"$UNSTABLE"} > /tmp/explain.txt 2>&1 || { cat /tmp/explain.txt && false; }
|
||
5 years ago
|
{ grep ' windows-integration: .* (targeted)$' /tmp/explain.txt || true; } > /tmp/windows.txt
|
||
8 years ago
|
|
||
7 years ago
|
if [ -s /tmp/windows.txt ] || [ "${CHANGED:+$CHANGED}" == "" ]; then
|
||
8 years ago
|
echo "Detected changes requiring integration tests specific to Windows:"
|
||
|
cat /tmp/windows.txt
|
||
|
|
||
|
echo "Running Windows integration tests for multiple versions concurrently."
|
||
|
|
||
8 years ago
|
platforms=(
|
||
7 years ago
|
--windows "${version}"
|
||
8 years ago
|
)
|
||
8 years ago
|
else
|
||
|
echo "No changes requiring integration tests specific to Windows were detected."
|
||
7 years ago
|
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
|
||
8 years ago
|
|
||
8 years ago
|
platforms=(
|
||
7 years ago
|
--windows "${version}"
|
||
8 years ago
|
)
|
||
8 years ago
|
fi
|
||
8 years ago
|
|
||
|
for version in "${python_versions[@]}"; do
|
||
7 years ago
|
changed_all_target="all"
|
||
6 years ago
|
changed_all_mode="default"
|
||
7 years ago
|
|
||
4 years ago
|
if [ "${version}" == "${python_default}" ]; then
|
||
|
# smoketest tests
|
||
7 years ago
|
if [ "${CHANGED}" ]; then
|
||
|
# with change detection enabled run tests for anything changed
|
||
|
# use the smoketest tests for any change that triggers all tests
|
||
7 years ago
|
ci="${target}"
|
||
6 years ago
|
changed_all_target="shippable/windows/smoketest/"
|
||
6 years ago
|
if [ "${target}" == "shippable/windows/group1/" ]; then
|
||
7 years ago
|
# only run smoketest tests for group1
|
||
6 years ago
|
changed_all_mode="include"
|
||
7 years ago
|
else
|
||
|
# smoketest tests already covered by group1
|
||
6 years ago
|
changed_all_mode="exclude"
|
||
7 years ago
|
fi
|
||
8 years ago
|
else
|
||
7 years ago
|
# without change detection enabled run entire test group
|
||
|
ci="${target}"
|
||
8 years ago
|
fi
|
||
7 years ago
|
else
|
||
7 years ago
|
# only run minimal tests for group1
|
||
6 years ago
|
if [ "${target}" != "shippable/windows/group1/" ]; then continue; fi
|
||
7 years ago
|
# minimal tests for other python versions
|
||
6 years ago
|
ci="shippable/windows/minimal/"
|
||
8 years ago
|
fi
|
||
7 years ago
|
|
||
7 years ago
|
# terminate remote instances on the final python version tested
|
||
|
if [ "${version}" = "${python_versions[-1]}" ]; then
|
||
|
terminate="always"
|
||
|
else
|
||
|
terminate="never"
|
||
|
fi
|
||
|
|
||
7 years ago
|
# shellcheck disable=SC2086
|
||
7 years ago
|
ansible-test windows-integration --color -v --retry-on-error "${ci}" ${COVERAGE:+"$COVERAGE"} ${CHANGED:+"$CHANGED"} ${UNSTABLE:+"$UNSTABLE"} \
|
||
6 years ago
|
"${platforms[@]}" --changed-all-target "${changed_all_target}" --changed-all-mode "${changed_all_mode}" \
|
||
7 years ago
|
--docker default --python "${version}" \
|
||
7 years ago
|
--remote-terminate "${terminate}" --remote-stage "${stage}" --remote-provider "${provider}"
|
||
8 years ago
|
done
|