Debian Codegraph @

.azure-pipelines/commands/windows.sh

raw symbols SCIP
1 #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash
2
3 set -o pipefail -eux
4
5 declare -a args
6 IFS='/:scip-shell filesystem . . `/:`.' read -ra args <<< "$1"
7
8 version="${args[1]}"
9 connection="${args[2]}"
10 connection_setting="${args[3]}"
11 powershell="${args[4]}"
12 group="${args[5]}"
13
14 target="shippable/windows/group${group}/"
15
16 stage="${S:-prod}"
17 provider="${P:-default}"
18
19 # python versions to test in order
20 IFS=' ' read -r -a python_versions <<< \
21 "$(PYTHONPATH="${PWD}/test/lib" python -c 'from ansible_test._internal import constants; print(" ".join(constants.CONTROLLER_PYTHON_VERSIONS))')"
22
23 # python version to run full tests on while other versions run minimal tests
24 python_default="$(PYTHONPATH="${PWD}/test/lib" python -c 'from ansible_test._internal import constants; print(constants.CONTROLLER_MIN_PYTHON_VERSION)')"
25
26 # version to test when only testing a single version
27 single_version=2022
28
29 # shellcheck disable=SC2086
30 ansible-test windows-integration --list-targets -v ${CHANGED:+"$CHANGED"} ${UNSTABLE:+"$UNSTABLE"} > /tmp/explain.txtscip-shell filesystem . . `/tmp/explain.txt`. 2>&1 || { catscip-shell system . . cat. /tmp/explain.txtscip-shell filesystem . . `/tmp/explain.txt`. && falsescip-shell system . . false.; }
31 { grepscip-shell system . . grep. ' windows-integration: .* (targeted)$' /tmp/explain.txtscip-shell filesystem . . `/tmp/explain.txt`. || truescip-shell system . . true.; } > /tmp/windows.txtscip-shell filesystem . . `/tmp/windows.txt`.
32
33 if [scip-shell system . . `[`. -s /tmp/windows.txtscip-shell filesystem . . `/tmp/windows.txt`. ] || [scip-shell system . . `[`. "${CHANGED:+$CHANGED}" == "" ]; then
34 echoscip-shell system . . echo. "Detected changes requiring integration tests specific to Windows:"
35 catscip-shell system . . cat. /tmp/windows.txtscip-shell filesystem . . `/tmp/windows.txt`.
36
37 echoscip-shell system . . echo. "Running Windows integration tests for the version ${version}."
38 else
39 echoscip-shell system . . echo. "No changes requiring integration tests specific to Windows were detected."
40 echoscip-shell system . . echo. "Running Windows integration tests for a single version only: ${single_version}"
41
42 if [scip-shell system . . `[`. "${version}" != "${single_version}" ]; then
43 echoscip-shell system . . echo. "Skipping this job since it is for: ${version}"
44 exit 0
45 fi
46 fi
47
48 for py_version in "${python_versions[@]}"; do
49 changed_all_target="all"
50 changed_all_mode="default"
51
52 if [scip-shell system . . `[`. "${py_version}" == "${python_default}" ]; then
53 # smoketest tests
54 if [scip-shell system . . `[`. "${CHANGED}" ]; then
55 # with change detection enabled run tests for anything changed
56 # use the smoketest tests for any change that triggers all tests
57 ci="${target}"
58 changed_all_target="shippable/windows/smoketest/"
59 if [scip-shell system . . `[`. "${target}" == "shippable/windows/group1/" ]; then
60 # only run smoketest tests for group1
61 changed_all_mode="include"
62 else
63 # smoketest tests already covered by group1
64 changed_all_mode="exclude"
65 fi
66 else
67 # without change detection enabled run entire test group
68 ci="${target}"
69 fi
70 else
71 # only run minimal tests for group1
72 if [scip-shell system . . `[`. "${target}" != "shippable/windows/group1/" ]; then continue; fi
73 # minimal tests for other python versions
74 ci="shippable/windows/minimal/"
75 fi
76
77 # terminate remote instances on the final python version tested
78 if [scip-shell system . . `[`. "${py_version}" = "${python_versions[-1]}" ]; then
79 terminate="always"
80 else
81 terminate="never"
82 fi
83
84 # shellcheck disable=SC2086
85 ansible-test windows-integration --color -v --retry-on-error "${ci}" ${COVERAGE:+"$COVERAGE"} ${CHANGED:+"$CHANGED"} ${UNSTABLE:+"$UNSTABLE"} \
86 --changed-all-target "${changed_all_target}" --changed-all-mode "${changed_all_mode}" \
87 --controller "docker:default,python=${py_version}" \
88 --target "remote:windows/${version},connection=${connection}+${connection_setting},provider=${provider},powershell=${powershell}" \
89 --remote-terminate "${terminate}" --remote-stage "${stage}"
90 done